On Mon, Mar 31, 2003 at 01:47:25AM +0800, Autrijus Tang wrote:
> On Sun, Mar 30, 2003 at 07:22:48PM +0200, [EMAIL PROTECTED] wrote:
> > In my opinion, again is more perlish. Especially because of its
> > pragma-like name (compare C<use if>, C<use only>, C<use again>).
> It is also confusing:
>     use Module::Name;
>     use again 'Module::Name';
> If I know nothing about your module, I'd expect line two to reload
> Module::Name unconditionally.  But maybe it's just me.  Arthur?

As the POD says, C<< use again 'Module::Name' >> loads Module::Name if:

- it has not been loaded with C<use again> before

... or ...

- it has been changed since the last time C<use again> loaded it.


Missing in the POD is that C<< use again 'Module::Name' >> is equivalent
to:
    BEGIN {
        require_again 'Module::Name';
        Module::Name->import() if Module::Name->can('import');
    }

Just like how C<< use Module::Name >> is equivalent to:
    BEGIN {
        require Module::Name;
        Module::Name->import() if Module::Name->can('import');
    }

__

'again' can indeed be confusing, but
'if_not_loaded_before_or_changed_since_last_use' simply is too long :)

The POD explains what it does in detail.

(And if even that is not detailed enough, feel free to read its source.
It's very readable and simple)


Juerd

Reply via email to