perl

mod_perl handles inclusion paths differently than cgi?

I have a script that's written in perl, and executed as CGI. It works fine. Recently I have installed the mod_perl module into apache, and used the PerlModule ModPerl::Registry directive. PerlModule ModPerl::Registry PerlModule CGI PerlSendHeader On Alias /perl/ /real/path/to/perl/scripts/ <Location /perl> SetHandler perl-script Perl...

Perl script to dynamically monitor web pages

I'm tweaking a perl script that I use to monitor sites (response times etc.) and I'm running into issues using Nagios::WebTransact. I want to be able to post to a page on one of my sites, get a response, and use the values in that response to post to the next page. It doesn't look like Nagios::WebTransact supports this. I read it has "l...

Is it possible to further simplify the resulting data structure from XML::Simple?

Given the below XML and script, I can produce this: { Item => { Details => { color => { Val => "green" }, texture => { Val => "smooth" } }, }, } but, I really want the following: { Item => { Details => { color => "green", texture => "smooth" }, }, } I can't use GroupTags here because there could be many Details item...

Sorting an Array Reference to Hashes

After executing these lines in Perl: my $data = `curl '$url'`; my $pets = XMLin($data)->(pets); I have an array reference that contains references to hashes: $VAR1 = [ { 'title' => 'cat', 'count' => '210' }, { 'title' => 'dog', 'count' => '210' } ] In Perl, how do I sort the h...

How do you install a certificate to the Perl certificate store? 401 unauthorized

How do you install a certificate to the Perl certificate store? I am getting the following error: 401 Unauthorized: Peer Certificate not verified. Is there a way to install the certificate the same way I would in Internet Explorer? ...

Programmatically read from STDIN or input file in Perl

What is the slickest way to programatically read from stdin or an input file (if provided) in Perl? ...

what is the best module in perl that can implement paros proxy functionality

did someone know about a good perl module that implement the most of the functionality of paros proxy http://www.parosproxy.org/ if yes could someone provide some modules do that ...

How can I call a post-statement conditional on multiple statements?

$df{key} =10 ; return ; if $result == 10 ; gives me an error. How can I achieve this? ...

DKIM wrong body hash using Perl CPAN Mail::DKIM::Signer

I have a script that is sending emails via SMTP and I'm trying to get it to sign emails with a DKIM signature using CPAN's Mail::DKIM::Signer. The trouble is I am getting error that the body hash is invalid. For example I sent the email below to the port25.com verifier and it is telling me the body hash it expected is "QFBPfFyqSONobf7fNo...

Multiple substitutions with a single regular expression in perl

Say I have the following in perl: my $string; $string =~ s/ /\\ /g; $string =~ s/'/\\'/g; $string =~ s/`/\\`/g; Can the above substitutions be performed with a single combined regular expression instead of 3 separate ones? ...

Formatting html.ep

Is there any tool available to just format (remove whitespace and indent correctly) an *.html.ep file? Its a template file of a perl app. Thanks ...

LDAP Active directory authentication question

I am trying to authenticate users on my site with their LDAP credentials. However the bind to the active directory seems to require my credentials first before I can authenticate any other username/passwords. I don't want to hardcode my credentials in the application. Any suggestions? $self->authen->config( DRIVER => [ 'Authen::Simple...

Global symbol requires explicit package name

Global symbol requires explicit package name ? why this is occured and what are various type it can cause this error ? ...

GD lib detecting CMYK

Hi there I have some code to resize an image w/ GD and Perl sub adjust_size { my ($localfile, $ext) = @_; # need to use truecolor option to support 24 bit colors $image = GD::Image->trueColor(1); $image = new GD::Image->new($localfile); my ($w, $h) = $image->getBounds(); ... everything works properly with RGB ...

How can I update multiple rows with one query (perl-mysql) ?

I need to update multiple rows with one query. For the insert we usually do something like INSERT INTO `table` (c1,c2,c3) VALUES (1,2,3), (4,5,6), .. Yet how can we do something similar for the update where each row has different values than the other? And there is a condition that is related to the id of each row? Any one faced ...

Hash of hashes in perl

I am trying to use a hash of hashes like this - #!/usr/bin/perl -w use strict; my %hash = (); sub hash_populate { my $name = "PQR,ABD,XYZ"; my @parts = split(/,/,$name); my $i = $parts[0]; my $a= $parts[1]; my $b = $parts[2]; $hash{$i} = {"A" =>$a,"B" => $b}; my $c = $hash{$i}{"A"}; print $c; } I g...

Edit binary plist under linux

How can i change values in the binary plist under linux os? I know i can to it under mac with defaults or PlistBuddy. I found some perl that convert from binary to text Mac::PropertyList::ReadBinary ...

Check length per file instead of entire request in CGI Upload

I am attempting to modify the Uber-Uploader perl script so that when an upload is checked if it meets the minimum requirements, it checks per file instead of just the entire request. I'm not too experienced with perl, and don't know how to do this. Currently the script simply does this: elsif($ENV{'CONTENT_LENGTH'} > $config{'max_uploa...

Remote function call using SOAP::Lite

Hi, I'm trying to write a client application in Perl using SOAP::Lite. I am trying to call a specific function, but I cannot seem to get the parameters right. I keep getting a response back saying "Found more elements in the soap envelope than required by the WSDL", but no more information beyond that. Is there any way in SOAP::Lite to...

How can I iterate over regular expression match variables in Perl?

I have a long regular expression that parses a text file into various match variables. For robustness, the match variables are likely to contain white space. I'd like to remove the whitespace in a systematic way by iterating over the match variables. For example, I have match variables $2 through $14 that contain some whitespace. I co...