On Thu, Mar 7, 2013 at 2:04 PM, shawn wilson <ag4ve...@gmail.com> wrote: > On Thu, Mar 7, 2013 at 12:43 PM, Lawrence Statton <lawre...@cluon.com> wrote: >> On 03/07/2013 11:29 AM, Lawrence Statton wrote: >>> >>> On 03/07/2013 11:00 AM, shawn wilson wrote: >>>> >>>> However, when I @EXPORT this function from a module, I get this: >>>> Can't call method "pre" on an undefined value at lib/Misc.pm line 45, >>>> <> line 723793. >>> >>> >>> Well, without seeing the code or the parameters passed, I can only guess >>> that your code is not coping with the case where there IS no answer for >>> a given query. >>> >>> if (my $answer = $packet->answer) { ... } >>> >> >> Oops ... your line 45 isn't MY line 45 ... >> >> if (my $packet = $dns->search(...)) { >> if (my $answer = $packet->answer()) { >> ... get some data out of the answer RRs .... >> } >> } >> > > Yeah, I've pretty much got it - actually, I'm good on that part, just > trying to figure why Net::Whois::ARIN isn't working like it is on cli: > sub rev_ip > { > my ($ip) = @_; > my $org = ''; > my $rev = ''; > > $org = join ", ", map { $_->OrgName } grep { $_->can("OrgName") } > $w->network($ip); > > my $packet = $dns->search($ip); > $rev = join ', ', map { $_->rdatastr } grep { $_->type eq 'PTR' } > $packet->answer if $packet; > > return "[$ip] $org $rev"; > }
-- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/