Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: autoload and packages

by TheHobbit (Pilgrim)
on May 11, 2002 at 09:54 UTC ( [id://165861]=note: print w/replies, xml ) Need Help??


in reply to AUTOLOAD and packages

Hi,
No need to use AUTOLOAD here, simply use Exporter as in

package foo; use Exporter; use vars qw(@ISA @EXPORT); @ISA=qw(Exporter); @EXPORT=qw(myfunc); sub myfunc { #something clever; } package main; use foo; #imports myfunc, so that now # main::myfunc is an alias for # foo::myfunc myfunc(1,2,3); #calls foo:myfunc(1,2,3)

Autoload is usefull for other things, like automatic generation of functions.

Cheers


Leo TheHobbit

Update minor typos corrected, thanks to gmax.

Replies are listed 'Best First'.
Re: Re: autoload and packages
by smackdab (Pilgrim) on May 11, 2002 at 20:10 UTC
    Thanks, but my function name is dynamic...I guess the "example" was too simplistic...Vadim's approach sounds like a bit of work, but would work...

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://165861]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (2)
As of 2024-04-26 03:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found