Skip Menu |

This queue is for tickets about the Import-Into CPAN distribution.

Report information
The Basics
Id: 78049
Status: resolved
Priority: 0/
Queue: Import-Into

People
Owner: Nobody in particular
Requestors: BAREFOOT [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 1.001000
Fixed in: 1.002000



Subject: Failure with autodie
This module works with everything I've thrown at it ... except autodie. That is, this code: #! /usr/bin/env perl use strict; use warnings; use autodie; open(IN, "foo"); close(IN); produces (as expected): Can't open 'foo' for reading: 'No such file or directory' at ex.pl line 7 whereas this code: #! /usr/bin/env perl use strict; use warnings; use Ex; open(IN, "foo"); close(IN); along with this module Ex.pm: package Ex; use Import::Into; use Module::Runtime qw< use_module >; sub import { use_module('autodie')->import::into(scalar caller); } 1; produces instead: Can't use string ("IN") as a symbol ref while "strict refs" in use at (eval 21) line 41. Sort of like if a 'use bareword::filehandles' had snuck in there. Am I doing something wrong, or is autodie just special somehow? Perl version, if it matters: This is perl 5, version 14, subversion 2 (v5.14.2) built for x86_64-linux
This is because of some extra checks autodie does regarding the filename it is being imported into. There is a pending branch that will allow you to specify a number of stack frames instead of a package name. When used, it makes the apparent filename being imported into match the correct value. Using that will allow autodie to work.
CC: BAREFOOT [...] cpan.org
Subject: Re: [rt.cpan.org #78049] Failure with autodie
Date: Tue, 17 Sep 2013 13:54:25 -0700
To: bug-Import-Into [...] rt.cpan.org
From: Buddy Burden <barefootcoder [...] gmail.com>
Show quoted text
> This is because of some extra checks autodie does regarding the filename it is being imported into. > > There is a pending branch that will allow you to specify a number of stack frames instead of a package name. When used, it makes the apparent filename being imported into match the correct value. Using that will allow autodie to work.
Okay. Just to clarify: this is a branch of Import::Into, or a branch of autodie? It sounds like the issue has to be addressed on the autodie side, so I assume you mean the latter. If so, we may as well close this ticket and I'll hop over to the autodie side and ask over there. :-)
On Tue Sep 17 16:54:37 2013, barefootcoder wrote: Show quoted text
> > This is because of some extra checks autodie does regarding the > > filename it is being imported into. > > > > There is a pending branch that will allow you to specify a number of > > stack frames instead of a package name. When used, it makes the > > apparent filename being imported into match the correct value. Using > > that will allow autodie to work.
> > Okay. Just to clarify: this is a branch of Import::Into, or a branch > of > autodie? It sounds like the issue has to be addressed on the autodie > side, so I assume you mean the latter. If so, we may as well close > this > ticket and I'll hop over to the autodie side and ask over there. :-)
It is a branch for Import::Into. While I would consider this an autodie bug, the Import::Into branch will allow you to work around it. So while reporting an autodie bug might not be a bad idea, I'm going to leave this open until the branch is merged and released.
The branch to fix this has been merged and released. It should now be possible to do: autodie->import::into(1); Where 1 is the number of stack frames up to apply to. This will apply to the correct package, and with the correct apparent filename for autodie to work correctly. It's also possible to specify the filename manually.