I found a bit of code on "http://www.stevekallestad.com/blog/reverse_ip_lookup_using_perl.html" This does a reverse IP lookup using Perl. I'm attempting to create a Perl/Tk interface using this code but I get the following error, I'm not sure what part of this error to address, I've checked to see if $ARGv has value (it does) using print. $ip does not get value as far as I can tell, I'm stumped.
Tk::Error: Can't call method "reverse_ip" without a package or object +reference at C:\_SCRIPT\Perl\DNS\TkNMLookup.pl line 21. Tk callback for .button Tk::__ANON__ at C:/Perl/lib/Tk.pm line 252 Tk::Button::Invoke at C:/Perl/lib/Tk/Button.pm line 135 <Key-Return> (command bound to event)
### Moduels to use use Tk; use Net::IP; use Net::DNS; ### New Window my $mw = MainWindow->new; $mw->title("IP Lookup"); $mw->Label(-text => "Enter an IP Address")->pack; $mw->Entry(-textvariable => \$a)->pack; $mw->Button(-text => "Lookup", -command => \&rlookup)->pack; $mw->Entry(-textvariable => \$b)->pack; MainLoop; sub rlookup{ use Net::IP; use Net::DNS; my $ARGV = $a; # print $ARGV; my $ip = new Net::IP($ARGV[0],4); my $res = new Net::DNS::Resolver; my $answer = $res->query($ARGV->reverse_ip(),'PTR'); my $namer = $answer->{'answer'}[0]; $b = $namer->{'ptrdname'}; }
KISMIF Keep it Simple make it Fun

In reply to Reverse IP Lookup by Mirky

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.