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...