Subject: | [BUG AND PATCH] item undefined item |
So I was writing some code to use the result of a whois query, however,
Net::Whois::ARIN::Network was returning an error when the item was
undefined rather then returning undef.
Here is a patch and some code to demonstrate the bug/fix as well.
Regards,
Josh
Subject: | Network-undef.patch |
--- Network-orig.pm 2007-12-23 23:45:31.000000000 -0500
+++ Network.pm 2007-12-23 23:46:23.000000000 -0500
@@ -174,7 +174,7 @@
}
}
- croak "Undefined subroutine \&$AUTOLOAD called";
+ return undef;
}
=head1 AUTHOR
Subject: | example.pl |
#!/usr/bin/perl -w
#
# Net::Whois::ARIN undefined / undef bug
#
# Joshua D. Abraham < jabra@spl0it.org >
# Sun Dec 23 23:53:48 EST 2007
#
use strict;
use Net::Whois::ARIN;
my $w = Net::Whois::ARIN->new(
host => 'whois.arin.net',
port => 43,
timeout => 30,
);
my @output = $w->network( gethostbyname('google.com') );
foreach my $net (@output) {
print "OrgName is " . $net->OrgName . "\n" if ( defined($net->OrgName));
print "NetHandle is " . $net->NetHandle . "\n" if ( defined($net->NetHandle));
print "NetRange is " . $net->NetRange . "\n" if ( defined($net->NetRange));
print "NameServer is " . $net->NameServer . "\n" if ( defined($net->NameServer));
}