Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

arno's scratchpad

by arno (Scribe)
on Aug 23, 2004 at 14:46 UTC ( #385088=scratchpad: print w/ replies, xml ) Need Help??

1) AUTOLOAD subroutine from
2) What i typed
3) The error message i got

I'm new to Autoloading and i face with a problem which i'd like to solve on my own.
I read the documentation of various things including AutoLoader module, UNIVERSAL class, and others but i still don't understand where constant subroutine comes from.
What i understand is that AUTOLOAD is executed when location of a subroutine failed that's to say the symbol name isn't in the stash %::.
Here, i believe $constname contains this unfound symbol because of the affectation :
($constant = $AUTOLOAD) =~ s/.*:://;
I believe constant($constname) is responsible of this error message as perldiag doesn't describe a similar compilation failure.

1) -- from :
sub AUTOLOAD { my $constname; ($constname = $AUTOLOAD) =~ s/.*:://; die "&Time::HiRes::constant not defined" if $constname eq 'constan +t'; my ($error, $val) = constant($constname); if ($error) { die $error; } { no strict 'refs'; *$AUTOLOAD = sub { $val }; } goto &$AUTOLOAD; }
2) --- what i did :

# perl -MTime::HiRes -e 1
3) --- what i get : ( i deleted what @INC contains in the output )

Can't locate loadable object for module Time::HiRes in @INC (@INC contains: ... ) at -e line 0
Compilation failed in require. BEGIN failed--compilation aborted.
Log In?

What's my password?
Create A New User
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (6)
As of 2016-07-23 18:42 GMT
Find Nodes?
    Voting Booth?
    What is your favorite alternate name for a (specific) keyboard key?

    Results (221 votes). Check out past polls.