I'm having great difficulty overriding the "_connect" method of the Net::ParseWhois module. Chances are that I'm just a dolt and need to understand objects more prior to diving in like this, but I've read through "Tom's Object Oriented Tutorial for Perl," and it lead me to believe that I can just do:
package MyParseWhois; require 5.004; use strict; use Carp; use vars qw/@ISA/; @ISA = ("Net::ParseWhois"); sub _connect { # My proxy connect code here.... } 1;
Now, when I do this and then try and drop in "use MyParseWhois" in place of "use Net::ParseWhois" it just doesn't work. If I omit the "use Carp" I get messload of errors, but even with it in I still get an error:
my $w = MyParseWhois::Domain->new($dom);
Error: "Can't locate object method "new" via package "MyParseWhois::Domain" at whois.pl line 8."

When "MyParseWhois" is changed back to "Net::ParseWhois" it works fine, but then it is not what I need. Now, I _know_ that this has got to be simple enough, but I've read and re-read the tutorial and it's just not working as described. There must be something that I am not seeing. Could someone please set me straight? I'm really only just getting into Objects and such, and I'm sure that I will eventually make sense of this, but for the moment I need my whois script working! Please almighty Perl Monks, help me see the light!

PM


In reply to Stupid Subclassing Question- Net::ParseWhois by pray2s8n

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.