in reply to Re: •Re: Re: •Re: How to use require...
in thread How to use require...

Let's go back to basics. To use autouse, you have to have a module that if you said use Login qw(login), it'd define and export a login() subroutine. Yes, that means you have to use Exporter in the proper fashion. I don't see that there.

Fix up your Login.pm file to be a proper module. Then try playing with autouse again. Something like:

## Login.pm package Login; use base qw(Exporter); @EXPORT_OK = qw(login login2); sub login { ... } sub login2 { ... } 1; ## main: use autouse Login => qw(login login2); ...

-- Randal L. Schwartz, Perl hacker
Be sure to read my standard disclaimer if this is a reply.

Replies are listed 'Best First'.
Re: •Re: Re: •Re: Re: •Re: How to use require...
by kiat (Vicar) on Jan 04, 2004 at 01:48 UTC
    Thanks a zillion :)

    I was a little unsure because even though I didn't have the two lines "use base qw(Exporter); @EXPORT_OK = qw(login login2);" in Login.pm, the code still works:

    ## Login.pm package Login; sub login { ... } sub login2 { ... } 1; ## main: use autouse Login => qw(login login2);
    I thought it was something unusual about "autouse" that precluded the need to use Exporter in Login.pm. But now that I've learnt that Login.pm needs to be a proper module, I'll make the change right away :)