in reply to use autouse with OOP
As far as autouse, all it does is to make stubs in the proper packages that will load the module if it isn't loaded. And you have to name the routines that you want to make stubs for. So assuming that the first subroutine that you call in your module is always "new", and that you aren't exporting anything from your module, it should be sufficient to do:
So that you'll get MyModule loaded when you go:use autouse 'MyModule' => 'MyModule::new';
Of course, if you call any other routines in your module first, they'd have to be added to the autouse list.my $mym = MyModule->new();
Subsequent accesses to methods (subroutines) defined in MyModule will work fine after the first one causes the autoload.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: use autouse with OOP
by DBX (Pilgrim) on Jun 14, 2001 at 23:10 UTC | |
by tye (Sage) on Jun 15, 2001 at 00:09 UTC | |
by bikeNomad (Priest) on Jun 14, 2001 at 23:51 UTC |