perl

What Perl module would you be lost without?

What Perl module would you be lost without? ...

True timeout on LWP::UserAgent request method

I am trying to implement a request to an unreliable server. The request is a nice to have, but not 100% required for my perl script to successfully complete. The problem is that the server will occasionally deadlock (we're trying to figure out why) and the request will never succeed. Since the server thinks it is live, it keeps the so...

How can I start an interactive console for Perl?

How can I start an interactive console for Perl, similar to the irb command for Ruby or python for Python? ...

Which framework should I use to write modules?

What's the best framework for writing modules -- ExtUtils::MakeMaker (h2xs) or Module::Build? ...

How can I get LWP to validate SSL server certificates?

How can I get LWP to verify that the certificate of the server I'm connecting to is signed by a trusted authority and issued to the correct host? As far as I can tell, it doesn't even check that the certificate claims to be for the hostname I'm connecting to. That seems like a major security hole (especially with the recent DNS vulnera...

How can I limit execution time for a Perl script in IIS?

This is a shared hosting environment. I control the server, but not necessarily the content. I've got a client with a Perl script that seems to run out of control every now and then and suck down 50% of the processor until the process is killed. With ASP scripts, I'm able to restrict the amount of time the script can run, and IIS will...

Why isn't Scalar::Util::Numeric installing correctly?

Sorry if this all runs together; it looks like the line breaks aren't showing up in the preview window. I got this output when running sudo cpan Scalar::Util::Numeric; thx, Josh. jmm@freekbox:~/bfwsandbox/sa/angel/astroportal/dtu8e/resources$ sudo cpan Scalar::Util::Numeric [sudo] password for jmm: CPAN: Storable loaded ok Going to re...

What is the most straightforward way to pad empty dates in sql results (on either mysql or perl end)?

I'm building a quick csv from a mysql table with a query like: select DATE(date),count(date) from table group by DATE(date) order by date asc; and just dumping them to a file in perl over a: while(my($date,$sum) = $sth->fetchrow) { print CSV "$date,$sum\n" } There are date gaps in the data, though: | 2008-08-05 | 4 |...

Which of these scripting languages is more appropriate for pen-testing?

First of all, I want to avoid a flame-war on languages. The languages to choose from are Perl, Python and Ruby . I want to mention that I'm confortable with all of them, but the problem is that I can't focus just on one. If for example , I see a cool Perl module, I have to try it out. If I see a nice Python app, I have to know how it's...

Perl: Use of uninitialized value in numeric lt (<) at /Date/Manip.pm

This has me puzzled. This code worked on another server, but it's failing on Perl v5.8.8 with Date::Manip loaded from CPAN today. Warning: Use of uninitialized value in numeric lt (<) at /home/downside/lib/Date/Manip.pm line 3327. at dailyupdate.pl line 13 main::__ANON__('Use of uninitialized value in numeric lt (<) at /home/dow...

How can I capitalize the first letter of each word in a string in Perl?

What is the easiest way to capitalize the first letter in each word of a string? ...

How can I package my Perl script to run on a machine without Perl?

People also often ask "How can I compile Perl?" while what they really want is to create an executable that can run on machines even if they don't have Perl installed. There are several solutions, I know of: perl2exe of IndigoStar It is commercial. I never tried. Its web site says it can cross compile Win32, Linux, and Solaris. Perl D...

How do I setup a local CPAN mirror?

What do I need to setup and maintain a local CPAN mirror? What scripts and best practices should I be aware of? ...

How can you get Perl to stop when referencing an undef value?

How do you get Perl to stop and give a stack trace when you reference an undef value, rather than merely warning? It seems that use strict; isn't sufficient for this purpose. ...

How can I capture the stdin and stdout of system command from a Perl script?

In the middle of a Perl script, there is a system command I want to execute. I have a string that contains the data that needs to be fed into stdin (the command only accepts input from stdin), and I need to capture the output written to stdout. I've looked at the various methods of executing system commands in Perl, and the open function...

Is there a difference between apache module vs cgi (concerning security)?

E.g. Is it more secure to use mod_php instead of php-cgi? Or is it more secure to use mod_perl instead of traditional cgi-scripts? I'm mainly interested in security concerns but speed might be an issue if there are significant differences. ...

Clean implementation of the strategy pattern in Perl

How do I write a clean implementation of the strategy pattern in Perl? I want to do it in a way that leverages Perl's features. ...

Outlook + Perl + Win32::Ole: How do you select calendar entries sorted by date?

Current code opens up an Outlook Calendar database as follow: my $outlook = Win32::OLE->GetActiveObject('Outlook.Application') || Win32::OLE->new('Outlook.Application', 'Quit'); my $namespace = $outlook->GetNamespace("MAPI"); ## only fetch entries from Jan 1, 2007 onwards my $restrictDates = "[Start] >= '01/01/2007'"; ...

Is there a really good web resource on moving to Moose?

The documentation with the module itself is pretty thin, and just tends to point to MOP. ...

How do I use transactions with Stomp and ActiveMQ (and Perl)?

I'm trying to replace some bespoke message queues with ActiveMQ, and I need to talk to them (a lot) from Perl. ActiveMQ provides a Stomp interface and Perl has Net::Stomp, so this seems like it should be fine, but it's not. Even if I send a BEGIN command over Stomp, messages sent with SEND are immediately published, and if I ABORT the ...