Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

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 Time::Hires.pm
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 Time::HiRes.pm :
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?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (9)
As of 2014-12-22 23:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (133 votes), past polls