Skip Menu |
 

This queue is for tickets about the autodie CPAN distribution.

Report information
The Basics
Id: 74246
Status: open
Priority: 0/
Queue: autodie

People
Owner: niels [...] thykier.net
Requestors: SPINER [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in:
  • 2.06_01
  • 2.10
Fixed in: (no value)



Subject: autodie weakens strict pragma
Download (untitled) / with headers
text/plain 670b
autodie seems to affect how the 'strict' pragma is applied to scalars. I'd expect that running the following two command would have exactly the same output: perl -Mstrict -E 'say $opendir' perl -Mautodie -Mstrict -E 'say $opendir' Instead, the first aborts with the expected 'global variable $opendir requires explicit package name' error, but the second continues as if I had written 'our $opendir' in there. The effect is limited to autodie replacements. If the command was 'say $something', the 'explicit package name' error occurs. Also, this following statement generates the 'explicit package name' error: perl -Mautodie=:dbm -Mstrict -E 'say $opendir'
Download (untitled) / with headers
text/plain 1.1k
On Sun Jan 22 17:17:34 2012, SPINER wrote: Show quoted text
> autodie seems to affect how the 'strict' pragma is applied to scalars. > > I'd expect that running the following two command would have exactly > the same output: > > perl -Mstrict -E 'say $opendir' > > perl -Mautodie -Mstrict -E 'say $opendir' > > Instead, the first aborts with the expected 'global variable $opendir > requires explicit package name' error, but the second continues as if I > had written 'our $opendir' in there. > > The effect is limited to autodie replacements. If the command was 'say > $something', the 'explicit package name' error occurs. Also, this > following statement generates the 'explicit package name' error: > > perl -Mautodie=:dbm -Mstrict -E 'say $opendir'
autodie must be assigning a scalar to the typeglob, from within another package. That turns on the ‘imported’ flag, which renders it exempt from strict vars. Sub::Delete had a similar problem, until I overcame it by aliasing a glob in the current package to the one being modified, if the variables are not imported. That alias is then used to assign the slots. It sounds as though autodie needs to do something similar.
Download (untitled) / with headers
text/plain 105b
Hi, FYI, there is a patch pending for this bug[1]. ~Niels [1] https://github.com/pjf/autodie/pull/37


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.