semio has asked for the wisdom of the Perl Monks concerning the following question:
I've noticed an issue running a script on different platforms. The following script, with perl 5.8.8 built for i386-freebsd-64int, runs without issue.
However the same code, when run on perl 5.8.8 built for MSWin32-x86-multi-thread, produces the following error:use strict; use XML::Simple qw(:strict); use LWP::UserAgent; use Data::Dumper; use POSIX qw(strftime); getNVD(); sub getNVD { my $ua = LWP::UserAgent->new; $ua->agent( "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.3) Gecko/200 +70309 Firefox/2.0.0.3" ); my $req = HTTP::Request->new( GET => 'http://nvd.nist.gov/download/nvdcve-recent.xml' ); $req->content_type('application/x-www-form-urlencoded'); my $res = $ua->request($req); my $fetch; if ( $res->is_success ) { $fetch = $res->content; } else { print $res->status_line; } my $today = strftime( "%Y-%m-%d", localtime ); my $yesterday = strftime( "%Y-%m-%d", localtime( time - 86400 ) ); my $xml = new XML::Simple; my $data = $xml->XMLin( "$fetch", KeyAttr => { cve => 'entry' }, ForceArray => [ 'cve', 'ref' ] ); my $e; foreach $e ( @{ $data->{entry} } ) { if ( $e->{severity} =~ /High/ && $e->{modified} =~ /($today|$yesterday)/ ) { print $e->{name}; } } #print Data::Dumper->Dump([\$data]); }
There appears to be an issue with the following section:Use of uninitialized value in pattern match (m//) at test.pl line 45.
Removing the references to $e->{severity} and $e->{modified} produce the same result. I should also note that the data across each platform when using Data::Dumper appears to be identical. Any thoughts on what may be causing this error?if ( $e->{severity} =~ /High/ && $e->{modified} =~ /($today|$yesterday)/ ) {
cheers.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: possible cross platform issue
by tirwhan (Abbot) on Jul 12, 2007 at 15:05 UTC | |
|
Re: possible cross platform issue
by dsheroh (Monsignor) on Jul 12, 2007 at 16:16 UTC |