Skip Menu |

This queue is for tickets about the autodie CPAN distribution.

Report information
The Basics
Id: 74246
Status: resolved
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: 2.23



Subject: autodie weakens strict pragma
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'
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.
Hi, FYI, there is a patch pending for this bug[1]. ~Niels [1] https://github.com/pjf/autodie/pull/37
On Sun Oct 13 06:09:57 2013, niels@thykier.net wrote: Show quoted text
> Hi, > > FYI, there is a patch pending for this bug[1]. > > ~Niels > > [1] https://github.com/pjf/autodie/pull/37 >
The patch was merged and released as a part of 2.23