On Wed, 23 Feb 2011, Brian Raven wrote:
> On Wed, 23 Feb 2011, Christian Walde wrote:

> > Solution: Make sure $_ isn't pointing at %Config when Exporter.pm
> > happens. This can be done as simple as this:
> >
> >      map { require ActiveState::Path } 1;
> >
> > (Though i'm sure more elegant solutions exist.)
 
[...]
 
> Regarding your work around. Map in a void context is usually frowned
> upon. Perhaps grep or possibly ...
> 
> for ('now') { require ActiveState::Path }
> 
> ... should have the same effect, i.e. aliasing $_ to something
> (hopefully) innocuous.

It turns out the canonical solution is to add

    local *_;

at the top of the subroutine.  Read all the gory details in perlsub.pod...

The important part to remember is:

    local $_;

is not safe! It does not mean that $_ is now undef and that you can
do whatever you want with it.  It may still have magic attached to
it, and (in this case) it may still be associated with a tied hash
or array element.

Cheers,
-Jan

_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to