perl

How should I implement batch processing for a commercial website?

Hi Guys, I'm really stuck on this one. Users enter some data on my website that I need to process later in a series of batch jobs. I really know always how to work with online transactions. I don't know what are the trends on top techologies to process data on a batch fashion. Should I use cron jobs, it's okay to use Perl for those bat...

How can I pass parameters to Perl subroutines defined using eval?

I'm using a config file (in YAML) to define types that are used later on to validate other config values required for my app: --- action: > use List::MoreUtils; my $value = $_; any { $value eq $_ } qw(fatal keep merge non-fatal replace); dir : return defined $_ ? -d $_ : -1; file : return defined $_ ? -f $_ : ...

How can I override Perl functions, enabling multiple overrides?

some time ago, I asked This question about overriding building perl functions. How do I do this in a way that allows multiple overrides? The following code yields an infinite recursion. What's the proper way to do this? If I redefine a function, I don't want to step on someone else's redefinition. package first; my $orig_system1; sub...

Why does ActivePerl 64-bit crash when I call sqlplus from backticks?

We came upon an error with a Perl script that processes data into an Oracle database. A few details: Server: Windows Server 2003 R2 64-bit Oracle: 10.2.0.4 Perl: ActivePerl 5.10 64-bit, build 1005 So the perl script connects to an Oracle database, and runs SQL to load data from another database. It runs the SQL through a sqlplus co...

IPC::Open3 Fails Running Under Apache

I have a module that uses IPC::Open3 (or IPC::Open2, both exhibit this problem) to call an external binary (bogofilter in this case) and feed it some input via the child-input filehandle, then reads the result from the child-output handle. The code works fine when run in most environments. However, the main use of this module is in a web...

Extract mail from Exchange and load into Mysql. Perl Win32::OLE or Perl Net::POP3, or try it in Ruby, or dabble in the, bletch, MS Access dark arts?

My problem is this: I need determine the timestamp of the first and last email sent from an Exchange account for every day that mail exists for. Also, for each day I need to rank the words that appear in each email so that I can report trend words for each day. I have two approaches to this I'm considering, and would welcome comments an...

cpan install module DBD::mysql fails, snow leopard

I am installing dependancies for Koha. This is requiring perl and cpan usage, of which this is my first time. I installed mysql via the hivelogic instructions. I am running 10.6.2 on a 32bit mac mini. Here is the terminal output: John-Breedloves-Mac-mini:~ john_breedlove$ sudo -H cpan -i DBD::mysql CPAN: Storable loaded ok (v2.19) Goin...

How to convert HTML to PDF using Perl?

Possible Duplicate: How can I convert HTML to PDF using Perl? Does anyone know best way to convert HTML to PDF using Perl? Is there any module available that can be used for this? My HTML contains few images and charts which should be converted properly to PDF. ...

How can I ignore some elements in <p> with Perl's HTML::TreeBuilder?

I have to parse this HTML: <p> <strong>abc:</strong> asfkjsdg </p> $para contains the value of the element <p>. I am using HTML::TreeBuilder. $para->as_text gives me abc:asfkjsdg How can I get only: asfkjsdg ...

Should use CGI.pm's header method to output the Content-Type header?

If I'm using the CGI module in Perl, I can do this $cgi = CGI->new(); $cgi->header(-type=>"text/html"); Or go for the classic print "Content-Type: text/html\r\n\r\n"; Does it matter which we use? Is there any difference between the two? Both seem to work. For me I'd go for the first if I was using CGI anyway, but if not then I wou...

How can I check if an id is present with Perl's HTML::TreeBuilder?

I have the following file: <p> <a href="a1">A1</a> <a href="a2">A2</a> <a id="a3">A3</a> <a href="a4">A4</a> </p> I need to skip the a tags from within the list obtained by $para->look_down("tag"=>'a');, which have an id attribute equal to some value. I am doing: $str = ''; $str = $anchor->attr('id'); if ($str != 'a3') { last; } ...

How can I run a Perl script through an ActiveX Control within Excel?

I want to run a Perl script at the click of a button inside an Excel spreadsheet. As the button is assigned to execute a VB macro, the macro should effectively execute the program. As my first ever VB script, this is what I came up with, which throws up an irritating Run-time error '424': Object required error. Sub RunPerlScript() ...

How can I use a string to access a Perl array element?

I have this Perl code: @str = qw(a1 a2 a3); my @array; $s1 = 'a1'; $s2 = 'a2'; $s3 = 'a3'; Now given s1, s2, s3 get references to $array[0], $array[1], $array[2] respectively. A switch case is possible. but how to get it in one or two statements. ...

Is Perl a good option for writing platform independent desktop applications?

Is Perl a good option for writing (possibly and partially) platform independent desktop applications? I know there are interesting widget libraries like GTK2 Perl and wxWidgets but I'm not familiar with development on Windows. Is it possible to write a good application with Perl and those tools, maybe embedding everything needed to avoi...

How can I tidy DBIx::Class::Schema::Loader's output?

We are currently introducing DBIx::Class in our team and we would like to start out with DBIx::Class::Schema::Loader. However, we have hard requirements on code style, i.e. we've got Perl::Tidy as part of our pre-commit script, since we haven't had any generated code before. Now, we'd have to make sure that the code that Schema::Loader g...

How can I get the proper output with this Perl program?

I have a problem with a regular expression. I am trying to extract the multiple conditions inside while and if. I am using Perl 5.8.6 on Windows XP. @conditions is an array that exactly contains the while loop contents, e.g.: while ( (condition A) && (condition B) ) You can assume @conditions array contains the above dat...

structure definition conflict between XS module and perl build

On OpenSolaris ($^O eq 'solaris', vers. 2.11), I'm trying to build an XS module which uses the XPGv4v2/Single Unix Spec. understanding of struct msghdr, specifically for "ancillary data" interrogation. However, the native perl (v5.8.4) was built without the requisite defines, and so the struct msghdr visible within my XS file is the old...

Efficient method to retrieve all permutations of a tree structure

Edited for a larger tree, for more examples. I have a tree structure that I need to generate all of the possible permutations of, with some restrictions. Given a tree like this: A1----(B1, B2) \ \___(C1) \__(E1, E2) / - A2----(B3, B4) \ \ \ \ \__(D1) \ \_(F1, ...

How can I reference the object when building it with Perl's Class::Struct?

Hi , I am new to object oriented Perl and i have to access member variable of same object in another subrutine of same object. Sample code is here : use Class::Struct; struct Breed => { name => '$', cross => '$', }; struct Cat => [ name => '$', kittens => '@', markings => '%', breed => 'Breed', b...

How can I convert yyyy-mm-dd hh:mm:ss into UTC in Perl?

convert datetime format yyyy-mm-dd hh:mm:ss (Might be a string) into UTC, Looking into DateTime but I don't see how to parse the string? UPDATE: Is this working correctly? require 5.002; use strict; use warnings; use DateTime::Format::DateManip; my $string = '2010-02-28 00:00:00'; my @dates = ( $string ); for my $date ( @date...