Undeclared functions at compile time is only a problem if you
call them without paranteheses, that is
my $result=function_one
sub function_one{
#blah, blah
}
If you wish to use the functions in LWP that way, you will have to do something like
this:
eval q(
use LWP::UserAgent qw(whatever);
my $ua=LWP::UserAgent::new;
);
Ugh, ugly...probably better to try something like this:
require LWP::UserAgent;
import LWP::UserAgent(qw(whatever));
no strict subs;
my $ua=LWP::UserAgent::New;
If you can manage to put a pair of parantheses after each method call,
this will do:
require LWP::UserAgent;
import LWP::UserAgent(qw(whatever));
my $ua=LWP::UserAgent::new();
#continue doing what you do with LWP...
Notice that theres no need for a no strict subs when you
tell perl that this is a function call.
AUTOLOAD is used in packages for handling calls to routines within the package
that are not defined in the package. One way to use this feature, is to do some custom
error handling.
In a program I'm writing at the moment, I use it to forward unknown method calls
to a different object. Sort of a mix between is-a and has-a relationship.
However, AUTOLOAD does not automatically load subroutines you need.
GoldClaw
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.