Re: autouse.pm: check stub, use goto in stub

2005-08-18 Thread Rafael Garcia-Suarez
Alexey Tourbin wrote:
 Hello,
 
 $ perl -e 'use autouse Pod::Usage = pod2usage((); pod2usage()'
 Undefined subroutine main::pod2usage called at -e line 1.
 $
 
 --- autouse.pm-   2004-07-04 21:32:39 +
 +++ autouse.pm2005-08-18 05:01:52 +

Thanks, both autouse patches applied as change #25302.

 @@ -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;
   }
 End of patch
 
 $ perl -e 'use autouse Pod::Usage = pod2usage((); pod2usage()'
 Prototype not terminated at (eval 1) line 1.
 ...propagated at /usr/lib/perl5/autouse.pm line 65.
 BEGIN failed--compilation aborted at -e line 1.
 $
 
 I guess the latter behaviour is more appropriate.  I also see no reason
 for saving a stub frame, so using goto should be ok.


autouse.pm: check stub, use goto in stub

2005-08-17 Thread Alexey Tourbin
Hello,

$ perl -e 'use autouse Pod::Usage = pod2usage((); pod2usage()'
Undefined subroutine main::pod2usage called at -e line 1.
$

--- autouse.pm- 2004-07-04 21:32:39 +
+++ autouse.pm  2005-08-18 05:01:52 +
@@ -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;
}
End of patch

$ perl -e 'use autouse Pod::Usage = pod2usage((); pod2usage()'
Prototype not terminated at (eval 1) line 1.
...propagated at /usr/lib/perl5/autouse.pm line 65.
BEGIN failed--compilation aborted at -e line 1.
$

I guess the latter behaviour is more appropriate.  I also see no reason
for saving a stub frame, so using goto should be ok.


pgpj2Kzgl4gpP.pgp
Description: PGP signature