I thought I'd add to this thread rather than start a new one.

I'm writing a little script to check whois servers. One funky feature will be the ability to check for domains which don't have a whois server, only a web-based look up - like .tv domains. To do this, I have a wrapper function which chooses whether to do a normal whois or a web whois. The web whois uses the LWP module, like a good perl script.

Now I don't want to load the LWP module - which is not small, right? - every time I run the script, but only when someone is looking up a .tv domain. Is there a simple way to "use" or "require" a module at run time, without getting compile time exceptions because Perl can't find methods and subroutines from the module within the code?

I have a feeling AUTOLOAD has something to do with this... any deep wisdom would be gratefully received.

Thanks

David


In reply to Related question: loading modules at run time by dash2
in thread How can I source other perl scripts from within a Perl script by juo

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.