perl

How can I make my Perl Jabber bot an event-driven program?

I'm trying to make a Jabber bot and I am having trouble keeping it running while waiting for messages. How do I get my script to continuously run? I have tried calling a subroutine that has a while loop that I, in theory, have set up to check for any messages and react accordingly but my script isn't behaving that way. Here is my sour...

Why don't the images fully display when I convert HTML to PDF with Perl's HTML::HTMLDoc?

I need to create a PDF file from the HTML I have created usign rrdcgi. This page contains the details and graphs in PNG format. I have written the below code using Perl module HTML::HTMLDoc to create a PDF file using saved HTML file. The images are of size width 1048 and hight 266 but when creating a PDF file the images are not shown com...

Is it possible to read multiple files with a single filehandle in Perl?

I have a few log files like these: /var/log/pureftpd.log /var/log/pureftpd.log-20100328 /var/log/pureftpd.log-20100322 Is it possible to load all of them into a single filehandle or will I need to load each of them separately? ...

How can I identify an argument as a year in Perl?

I have created a file argument.pl which takes several arguments first of which should be in form of a year For example: 2010 23 type. Here 2010 is a year my code does something like: use strict; use warning use Date::Calc qw(:all); my ($startyear, $startmonth, $startday) = Today(); my $weekofyear = (Week_of_Year ($startyear,$startmonth...

Why isn't module_filters filtering Mail::IspMailGate in CPAN::Mini?

Edited - Ummm - now have a module in schwigon giving same problem !! I am on a corporate PC that forces mcshield on everything that moves. I get blocked when trying to mirror on ... authors/id/J/JV/JV/EekBoek-2.00.01.tar.gz ... updated authors/id/J/JV/JV/CHECKSUMS ... updated Could not stat tmpfile '/cygdrive/t/cpan_mirror/authors/id/J...

How can I convert Perl regular expressions to boost regular expressions?

What is equivalent to perl expression: /ing$|ed$|en$/ in boost regular expression? Words end with ing or ed or en should match with reg expression in boost! ...

Should I use Perl or PHP or something else for this project?

I'm about to embark on a project that will need to: Process XML Heavy text parsing of non-xml documents Insertion of data from xml and non-xml documents into a relational DB. Present processed data to user from db using webpages. Must handle load very well. The website will be subject to short periods of very heavy loads to pages (30...

How can I add file locations to a database after they are uploaded using a Perl CGI script?

I have a CGI program I have written using Perl. One of its functions is to upload pics to the server. All of it is working well, including adding all kinds of info to a MySQL db. My question is: How can I get the uploaded pic files location and names added to the db? I would rather that instead of changing the script to actually uploa...

How do I tell perl to execute a piece of generated Perl code?

I am trying to catch the string cd /a/b/c and do the following conversion (as part of a larger Perl program). If cd /a/b/c exists then convert cd /a/b/c chdir '/a/b/c' and execute chdir '/a/b/c' I can do the conversion; I can't tell perl to execute my command. ...

How do you access the HTTP basic authentication username from perl?

I need to get the remote user name in my CGI script. Where do I find that? I want to display that name on the page that I return. ...

Why doesn't my continue execute the next when block in Perl 5.10?

When I run this: use feature ':5.10'; $x=1; given ($x) { when(1) { say '1'; $x = 2; continue; } when (2) { say '2'; } } This should print both 1 and 2, but it only prints 1. Am I missing something? EDIT: I have added $x = 2 and it still prints only "1" ...

What is the Python equivalent of Perl's FindBin?

In perl, the FindBin module is used to locate directory of original script. What's the best way to get this directory in python? ...

When is a subroutine reference in @INC called?

As the title says, I'm not clear on when such a subroutine will be called. From the require page at perldoc one can write: push @INC, \&my_sub; sub my_sub { my ($coderef, $filename) = @_; # $coderef is \&my_sub ... } but where does this go exactly? The required package or the requiring script (or package)? I've tried both wit...

Dequeue an array in perl with thread::queue

I am trying to process data with a set of threads and enqueue it with another, currently the enqueueing and dequeueing process doesn't seem to be working Any thoughs?? sub process() { while (my @DataElement = $DataQueue->dequeue()) { print "\t".$DataElement[0]."\n"; } } I use the following to enqueue the data my @l;...

How do I suppress the "notify Microsoft" crash dialogs when I call a command from Perl?

I am calling a command-line program from my Perl script. When these programs crash, I am prompted with a messagebox asking me if I want to notify Microsoft. Since this is an automated system it would be desirable if I could suppress that message and continue with other things in my script. Is this possible? ...

JavaScript To Clear Form Field On Submit Before Form Submission To Perl Script

We have a very long form that has a number of fields and 2 different submit buttons. When a user clicks the 1st submit button ("Photo Search") the form should POST and our script will do a search for matching photos based on what the user entered in the text input ("photo_search_text") next to the 1st submit button and reload the entire ...

Why do I get a "Day too big" error from Perl?

I have been helping someone debug some code where the error message was "Day too big". I know that this springs from localtime and the Y2038 bug (most google results appear to be people dealing with cookies expiring well into the future). We appear to have 'fixed' the problem by using time to get the current date. However, given that ...

From a Perl test file, how do I check the contents of a file?

I want to test a script I have written in Perl and specifically check what output it writes to file. I wrote it some time ago and don't want to modify it to the extent of turning it into a module but would like to regression test it before adding some small functional changes. So far I have use Test::Command tests => 10; exit_is_num($...

Why does my Net::Telnet program timeout?

I'm written small code to connect to remote server using Perl but observing error messages #!/usr/bin/perl -w use Net::Telnet; $telnet = new Net::Telnet ( Timeout=>60, Errmode=>'die'); $telnet->open('192.168.50.40'); $telnet->waitfor('/login:/'); $telnet->print('queen'); $telnet->waitfor('/password:/'); $telnet->print('kinG!'); ...

Is the performance hit with using MooseX::Declare mainly encountered during startup?

Is the performance hit with using MooseX::Declare mainly encountered while it does its initial magic (i.e. "translating" the definition into standard Perl syntax)? i.e. once the compile and initial runtime setup is complete, is there a performance difference in calling a MooseX::Declare method vs a method defined via traditional declarat...