This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
autouse.pm: remove unneeded eval
authorAlexey Tourbin <at@altlinux.ru>
Thu, 18 Aug 2005 08:13:24 +0000 (12:13 +0400)
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>
Thu, 18 Aug 2005 08:00:53 +0000 (08:00 +0000)
Date: Thu, 18 Aug 2005 08:13:24 +0400
Message-ID: <20050818041324.GO19097@solemn.turbinal.org>

Subject: autouse.pm: check stub, use goto in stub
From: Alexey Tourbin <at@altlinux.ru>
Date: Thu, 18 Aug 2005 09:06:20 +0400
Message-ID: <20050818050620.GP19097@solemn.turbinal.org>

p4raw-id: //depot/perl@25302

lib/autouse.pm

index 85db01f..67c4e01 100644 (file)
@@ -3,7 +3,7 @@ package autouse;
 #use strict;           # debugging only
 use 5.003_90;          # ->can, for my $var
 
-$autouse::VERSION = '1.04';
+$autouse::VERSION = '1.05';
 
 $autouse::DEBUG ||= 0;
 
@@ -50,8 +50,7 @@ sub import {
 
        my $load_sub = sub {
            unless ($INC{$pm}) {
-               eval {require $pm};
-               die if $@;
+               require $pm;
                vet_import $module;
            }
             no warnings 'redefine';
@@ -63,7 +62,8 @@ sub import {
        };
 
        if (defined $proto) {
-           *$closure_import_func = eval "sub ($proto) { &\$load_sub }";
+           *$closure_import_func = eval "sub ($proto) { goto &\$load_sub }"
+               || die;
        } else {
            *$closure_import_func = $load_sub;
        }