From: Jarkko Hietaniemi Date: Thu, 26 Apr 2001 18:43:51 +0000 (+0000) Subject: The Time::Piece conspiracy unmasked!!! X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=07766739ad671051f274806a83c05be36e7ca89a;p=p5sagit%2Fp5-mst-13.2.git The Time::Piece conspiracy unmasked!!! From: Mike Guy Date: Thu, 26 Apr 2001 19:02:50 +0100 Message-Id: Subject: [PATCH] that's enough UNIVERSAL stuff for one day ... From: Mike Guy Date: Thu, 26 Apr 2001 19:08:21 +0100 Message-Id: Subject: Re: [PATCH] that's enough UNIVERSAL stuff for one day ... From: Graham Barr Date: Thu, 26 Apr 2001 19:12:03 +0100 Message-ID: <20010426191203.A70835@pobox.com> Eradicate UNIVERSAL (Mike) and remove the fallback Perl code (Graham) p4raw-id: //depot/perl@9859 --- diff --git a/ext/List/Util/lib/List/Util.pm b/ext/List/Util/lib/List/Util.pm index 053134d..641ca97 100644 --- a/ext/List/Util/lib/List/Util.pm +++ b/ext/List/Util/lib/List/Util.pm @@ -19,51 +19,6 @@ eval { 1 }; -eval <<'ESQ' unless defined &reduce; - -# This code is only compiled if the XS did not load - -use vars qw($a $b); - -sub reduce (&@) { - my $code = shift; - - return shift unless @_ > 1; - - my $caller = caller; - local(*{$caller."::a"}) = \my $a; - local(*{$caller."::b"}) = \my $b; - - $a = shift; - foreach (@_) { - $b = $_; - $a = &{$code}(); - } - - $a; -} - -sub sum (@) { reduce { $a + $b } @_ } - -sub min (@) { reduce { $a < $b ? $a : $b } @_ } - -sub max (@) { reduce { $a > $b ? $a : $b } @_ } - -sub minstr (@) { reduce { $a lt $b ? $a : $b } @_ } - -sub maxstr (@) { reduce { $a gt $b ? $a : $b } @_ } - -sub first (&@) { - my $code = shift; - - foreach (@_) { - return $_ if &{$code}(); - } - - undef; -} -ESQ - 1; __END__ diff --git a/ext/List/Util/lib/Scalar/Util.pm b/ext/List/Util/lib/Scalar/Util.pm index ee65667..2b81d8e 100644 --- a/ext/List/Util/lib/Scalar/Util.pm +++ b/ext/List/Util/lib/Scalar/Util.pm @@ -26,69 +26,6 @@ sub export_fail { @_; } -eval <<'ESQ' unless defined &dualvar; - -push @EXPORT_FAIL, qw(weaken isweak dualvar); - -# The code beyond here is only used if the XS is not installed - -# Hope nobody defines a sub by this name -sub UNIVERSAL::a_sub_not_likely_to_be_here { ref($_[0]) } - -sub blessed ($) { - local($@, $SIG{__DIE__}, $SIG{__WARN__}); - length(ref($_[0])) - ? eval { $_[0]->a_sub_not_likely_to_be_here } - : undef -} - -sub reftype ($) { - local($@, $SIG{__DIE__}, $SIG{__WARN__}); - my $r = shift; - my $t; - - length($t = ref($r)) or return undef; - - # This eval will fail if the reference is not blessed - eval { $r->a_sub_not_likely_to_be_here; 1 } - ? do { - $t = eval { - # we have a GLOB or an IO. Stringify a GLOB gives it's name - my $q = *$r; - $q =~ /^\*/ ? "GLOB" : "IO"; - } - or do { - # OK, if we don't have a GLOB what parts of - # a glob will it populate. - # NOTE: A glob always has a SCALAR - local *glob = $r; - defined *glob{ARRAY} && "ARRAY" - or defined *glob{HASH} && "HASH" - or defined *glob{CODE} && "CODE" - or length(ref(${$r})) ? "REF" : "SCALAR"; - } - } - : $t -} - -sub tainted { - local($@, $SIG{__DIE__}, $SIG{__WARN__}); - local $^W = 0; - eval { kill 0 * $_[0] }; - $@ =~ /^Insecure/; -} - -sub readonly { - return 0 if tied($_[0]) || (ref(\($_[0])) ne "SCALAR"); - - local($@, $SIG{__DIE__}, $SIG{__WARN__}); - my $tmp = $_[0]; - - !eval { $_[0] = $tmp; 1 }; -} - -ESQ - 1; __END__ diff --git a/ext/Time/Piece/Piece.pm b/ext/Time/Piece/Piece.pm index 64830f4..9792555 100644 --- a/ext/Time/Piece/Piece.pm +++ b/ext/Time/Piece/Piece.pm @@ -7,7 +7,6 @@ require Exporter; require DynaLoader; use Time::Seconds; use Carp; -use UNIVERSAL; @ISA = qw(Exporter DynaLoader); diff --git a/gv.c b/gv.c index eafd982..462002c 100644 --- a/gv.c +++ b/gv.c @@ -163,7 +163,7 @@ S_gv_init_sv(pTHX_ GV *gv, I32 sv_type) Returns the glob with the given C and a defined subroutine or C. The glob lives in the given C, or in the stashes -accessible via @ISA and @UNIVERSAL. +accessible via @ISA and UNIVERSAL::. The argument C should be either 0 or -1. If C, as a side-effect creates a glob with the given C in the given C