From 55a105fde08b8ff7e431e93257b2fe180eb0327d Mon Sep 17 00:00:00 2001 From: "nick@babyhippo.com" Date: Wed, 4 Oct 2000 13:06:45 +0100 Subject: [PATCH] [ID 20001004.003] installman "Ambiguous call resolved as CORE::" Message-Id: <20001004120645.A7356@babyhippo.com> Retract 7118 and 7135. p4raw-id: //depot/perl@7140 --- installman | 6 +++--- installperl | 10 +++++----- op.c | 3 --- t/pragma/subs.t | 24 ++++++++++++++++++++++++ 4 files changed, 32 insertions(+), 11 deletions(-) diff --git a/installman b/installman index 1fd964d..72c76fd 100755 --- a/installman +++ b/installman @@ -244,7 +244,7 @@ sub link { sub rename { my($from,$to) = @_; - if (-f $to and not &unlink($to)) { + if (-f $to and not unlink($to)) { my($i); for ($i = 1; $i < 50; $i++) { last if CORE::rename($to, "$to.$i"); @@ -252,8 +252,8 @@ sub rename { warn("Cannot rename to `$to.$i': $!"), return 0 if $i >= 50; # Give up! } - &link($from,$to) || return 0; - &unlink($from) + link($from,$to) || return 0; + unlink($from); } sub chmod { diff --git a/installperl b/installperl index 07c9bba..c65af5a 100755 --- a/installperl +++ b/installperl @@ -511,7 +511,7 @@ sub safe_unlink { sub safe_rename { my($from,$to) = @_; - if (-f $to and not &unlink($to)) { + if (-f $to and not unlink($to)) { my($i); for ($i = 1; $i < 50; $i++) { last if rename($to, "$to.$i"); @@ -520,7 +520,7 @@ sub safe_rename { if $i >= 50; # Give up! } link($from,$to) || return 0; - &unlink($from); + unlink($from); } sub link { @@ -625,16 +625,16 @@ sub installlib { #but we have to delete old *.al and *.ix files from the 5.000 #distribution: #This might not work because $archname might have changed. - &unlink("$installarchlib/$name"); + unlink("$installarchlib/$name"); } $packlist->{"$installlib/$name"} = { type => 'file' }; if (compare($_, "$installlib/$name") || $nonono) { - &unlink("$installlib/$name"); + unlink("$installlib/$name"); mkpath("$installlib/$dir", $verbose, 0777); # HP-UX (at least) needs to maintain execute permissions # on dynamically-loaded libraries. copy_if_diff($_, "$installlib/$name") - and &chmod($name =~ /\.(so|$dlext)$/o ? 0555 : 0444, + and chmod($name =~ /\.(so|$dlext)$/o ? 0555 : 0444, "$installlib/$name"); } } diff --git a/op.c b/op.c index 3389d93..84a1df9 100644 --- a/op.c +++ b/op.c @@ -4561,9 +4561,6 @@ Perl_newATTRSUB(pTHX_ I32 floor, OP *o, OP *proto, OP *attrs, OP *block) CvGV(cv) = (GV*)SvREFCNT_inc(gv); CvFILE(cv) = CopFILE(PL_curcop); CvSTASH(cv) = PL_curstash; - /* use subs; etc may have turned this on - As we're (re)defining the sub here it's definately not imported */ - GvIMPORTED_CV_off(gv); #ifdef USE_THREADS CvOWNER(cv) = 0; if (!CvMUTEXP(cv)) { diff --git a/t/pragma/subs.t b/t/pragma/subs.t index cebb635..7e48e20 100755 --- a/t/pragma/subs.t +++ b/t/pragma/subs.t @@ -114,6 +114,30 @@ EXPECT 3 ######## +# override a built-in function, call after definition +use subs qw( open ) ; +sub open { print $_[0] + $_[1], "\n" } +open 1,2 ; +EXPECT +3 +######## + +# override a built-in function, call with () +use subs qw( open ) ; +open (1,2) ; +sub open { print $_[0] + $_[1], "\n" } +EXPECT +3 +######## + +# override a built-in function, call with () after definition +use subs qw( open ) ; +sub open { print $_[0] + $_[1], "\n" } +open (1,2) ; +EXPECT +3 +######## + --FILE-- abc Fred 1,2 ; 1; -- 2.7.4