Permalink
Browse files

Can't avoid inheriting from autodie or do it at runtime.

MRO gets upset when we try to inherit from autodie at runtime.
Bring it in closer to the import routine so its more obvious.
Wrap it in an if statement in preparation for adding the feature
skip functionality.
  • Loading branch information...
1 parent 054eaa3 commit 9e30d2f71faadebd4820a543b189b35f6c747719 @schwern schwern committed Feb 23, 2013
Showing with 7 additions and 6 deletions.
  1. +7 −6 lib/perl5i/2.pm
View
@@ -16,10 +16,6 @@ use perl5i::VERSION; our $VERSION = perl5i::VERSION->VERSION;
our $Latest = perl5i::VERSION->latest;
-
-# This works around their lexical nature.
-use parent 'autodie';
-
my %Features = (
autobox => sub {
my ($class, $caller) = @_;
@@ -140,6 +136,9 @@ my %Features = (
},
);
+# This is necessary for autodie to work and be lexical
+use parent 'autodie';
+
## no critic (Subroutines::RequireArgUnpacking)
sub import {
my $class = shift;
@@ -154,8 +153,10 @@ sub import {
}
# autodie needs a bit more convincing
- @_ = ( $class, ":all" );
- goto &autodie::import;
+ if( 1 ) {
+ @_ = ( $class, ":all" );
+ goto &autodie::import;
+ }
}
sub unimport { $^H{perl5i} = 0 }

0 comments on commit 9e30d2f

Please sign in to comment.