summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2009-10-02 15:32:49 +0100
committerNicholas Clark <nick@ccl4.org>2009-10-02 15:32:49 +0100
commit8d1f803052eb91513053e3c5aa0d967e4948a64a (patch)
treed81e9575db1341b6d8c1bb376889db8fed27d346 /ext
parent490d18887fd62e9b6c93b9bf4f54a9d43e32b034 (diff)
downloadperl-8d1f803052eb91513053e3c5aa0d967e4948a64a.tar.gz
Move List::Util from ext/ to cpan/
Diffstat (limited to 'ext')
-rw-r--r--ext/List-Util/Changes372
-rw-r--r--ext/List-Util/ListUtil.xs613
-rw-r--r--ext/List-Util/Makefile.PL86
-rw-r--r--ext/List-Util/README23
-rw-r--r--ext/List-Util/XS.pp45
-rw-r--r--ext/List-Util/lib/List/Util.pm233
-rw-r--r--ext/List-Util/lib/List/Util/PP.pm75
-rw-r--r--ext/List-Util/lib/List/Util/XS.pm45
-rw-r--r--ext/List-Util/lib/Scalar/Util.pm283
-rw-r--r--ext/List-Util/lib/Scalar/Util/PP.pm109
-rw-r--r--ext/List-Util/multicall.h166
-rw-r--r--ext/List-Util/t/00version.t25
-rw-r--r--ext/List-Util/t/blessed.t54
-rw-r--r--ext/List-Util/t/dualvar.t61
-rw-r--r--ext/List-Util/t/expfail.t29
-rw-r--r--ext/List-Util/t/first.t115
-rw-r--r--ext/List-Util/t/isvstring.t33
-rw-r--r--ext/List-Util/t/lln.t46
-rw-r--r--ext/List-Util/t/max.t69
-rw-r--r--ext/List-Util/t/maxstr.t36
-rw-r--r--ext/List-Util/t/min.t69
-rw-r--r--ext/List-Util/t/minstr.t36
-rw-r--r--ext/List-Util/t/openhan.t89
-rw-r--r--ext/List-Util/t/p_00version.t26
-rw-r--r--ext/List-Util/t/p_blessed.t7
-rw-r--r--ext/List-Util/t/p_first.t8
-rw-r--r--ext/List-Util/t/p_lln.t7
-rw-r--r--ext/List-Util/t/p_max.t7
-rw-r--r--ext/List-Util/t/p_maxstr.t7
-rw-r--r--ext/List-Util/t/p_min.t7
-rw-r--r--ext/List-Util/t/p_minstr.t7
-rw-r--r--ext/List-Util/t/p_openhan.t7
-rw-r--r--ext/List-Util/t/p_readonly.t7
-rw-r--r--ext/List-Util/t/p_reduce.t8
-rw-r--r--ext/List-Util/t/p_refaddr.t7
-rw-r--r--ext/List-Util/t/p_reftype.t7
-rw-r--r--ext/List-Util/t/p_shuffle.t7
-rw-r--r--ext/List-Util/t/p_sum.t7
-rw-r--r--ext/List-Util/t/p_tainted.t12
-rw-r--r--ext/List-Util/t/proto.t59
-rw-r--r--ext/List-Util/t/readonly.t51
-rw-r--r--ext/List-Util/t/reduce.t152
-rw-r--r--ext/List-Util/t/refaddr.t111
-rw-r--r--ext/List-Util/t/reftype.t61
-rw-r--r--ext/List-Util/t/shuffle.t36
-rw-r--r--ext/List-Util/t/stack-corruption.t30
-rw-r--r--ext/List-Util/t/sum.t69
-rw-r--r--ext/List-Util/t/tainted.t34
-rw-r--r--ext/List-Util/t/weak.t208
49 files changed, 0 insertions, 3661 deletions
diff --git a/ext/List-Util/Changes b/ext/List-Util/Changes
deleted file mode 100644
index 737b94dd68..0000000000
--- a/ext/List-Util/Changes
+++ /dev/null
@@ -1,372 +0,0 @@
-1.21 -- Mon May 18 10:32:14 CDT 2009
-
- * Change build system for perl-only install not to need to modify blib
- * When building inside perl, tests for weaken should be always run (Alexandr Ciornii)
-
-1.20 -- Wed May 13 16:42:53 CDT 2009
-
-*** NOTE***
-This distribution now requires perl 5.6 or greater
-
-Bug Fixes
- * Fixed stack pop issue in POP_MULTICALL
- * Fixed error reporting in import when XS not compiled
- * Check first argument to reduce is a CODE reference to avoid segfault
- * Handle overloaded and tied values
- * Fix tainted test to run on Win32
-
-Enhancements
- * Added List::Util::XS so authors can depend on XS version
- * Removed need for dummy methods in UNIVERSAL for perl-only code
-
-
-1.19 -- Sun Dec 10 09:58:03 CST 2006
-
-Bug Fixes
- * Fix invalid conversion from `const char*' to `char*' warnings
- * Avoid Makefile error when building on Win32
- * Fix undefined symbol error for perl < 5.9.0
- * Fix hardcoded "/" in a filepath that causes p_tainted.t to fail on VMS
-
-Documentation
- * Document that reduce calls BLOCK in a scalar context
- * Add SEE ALSO sections to docs
-
-Enhancements
- * A new regression test for readonly, taking a reference to a constant passed to a sub
-
-1.18 -- Fri Nov 25 09:30:29 CST 2005
-
-Bug Fixes
- * Fix pure-perl version of refaddr to avoid blessing an un-blessed reference
- * Fix memory leak in first() and reduce()
- * Pure perl version of looks_like_number now matches XS version for
- references and undef. It will now return undef
-
-Enhancements
- * Support for using XSLoader instead of DynaLoader
- * Use new multicall API
-
-1.17 -- Mon May 23 08:55:26 CDT 2005
-
-Bug Fixes
- * Update XS code to declare PERL_UNUSED_DECL conditionally
-
-1.16 -- Fri May 20 10:22:49 CDT 2005
-
-Bug Fixes
- * Change to refaddr.t test to avoid false errors on some 64 bit platforms
- * Fix all perl only tests to work when in the core build environment
- * Fix looks like number test to work for 5.8.5 and above
-
-1.15 -- Fri May 13 11:01:15 CDT 2005
-
-Bug Fixes
- * Fixed memory leak in first()
-
-Enhancements
- * Converted tests to use Test::More
- * Improved test coverage
- * Changed Makefile.PL to use Module::Install
- * Refactor use of Sv..X() macros to be Sv.._set()
- * Changes from Jarkko for Symbian port of Perl
- * Documentation updates to weaken()
-
-1.14 -- Sat May 22 08:01:19 BST 2004
-
-Bug Fixes
- * Fixed memory leak in reduce()
- * Added tests to check passing a reference to a constant to weaken() in perl >= 5.008003
- * Fixed looks_like_number(undef) to return false for perl >= 5.009002
- * Fixed bug in refaddr() when passed a tied variable
-
-Switch to svn repository at http://svn.mutatus.co.uk/wsvn/Scalar-List-Utils/trunk/
-Old perforce revision log below
-
-Change 827 on 2003/09/25 by <gbarr@pobox.com> (Graham Barr)
-
- Release 1.13
-
-Change 826 on 2003/09/25 by <gbarr@pobox.com> (Graham Barr)
-
- Fix NV casting issue with some compilers
-
-Change 825 on 2003/08/14 by <gbarr@pobox.com> (Graham Barr)
-
- Release 1.12
-
-Change 824 on 2003/08/14 by <gbarr@pobox.com> (Graham Barr)
-
- Don't directly use the SV returned as $a in the next iteration,
- take a copy instead. Fixes problem if the code block result was from
- an eval or sub call
-
-Change 823 on 2003/08/14 by <gbarr@pobox.com> (Graham Barr)
-
- Install into the 'perl' installdirs for >= 5.008
-
-Change 822 on 2003/08/14 by <gbarr@pobox.com> (Graham Barr)
-
- Fix test for EBCDIC portability
-
-Change 771 on 2003/03/03 by <gbarr@pobox.com> (Graham Barr)
-
- Get path for make from $Config
-
-Change 770 on 2003/02/14 by <gbarr@pobox.com> (Graham Barr)
-
- Release 1.11
-
-Change 769 on 2003/02/14 by <gbarr@pobox.com> (Graham Barr)
-
- Add t/proto.t to MANIFEST
-
-Change 768 on 2003/02/14 by <gbarr@pobox.com> (Graham Barr)
-
- Add set_prototype from Rafael Garcia-Suarez
-
-Change 767 on 2003/02/14 by <gbarr@pobox.com> (Graham Barr)
-
- Fix t/isvstring.t so it does not cause perl5.004 to segv
- because of the exit from within BEGIN
-
-Change 766 on 2003/02/14 by <gbarr@pobox.com> (Graham Barr)
-
- Change how patchlevel.h is included and check we got what we wanted (from Jarkko)
-
-Change 765 on 2003/02/14 by <gbarr@pobox.com> (Graham Barr)
-
- Add -DPERL_EXT to DEFINEs, requested by Jarkko for 5.8.1
-
-Change 764 on 2003/02/04 by <gbarr@pobox.com> (Graham Barr)
-
- Release 1.10
-
-Change 763 on 2003/02/04 by <gbarr@pobox.com> (Graham Barr)
-
- Fix linking error for older perls
-
-Change 762 on 2003/02/04 by <gbarr@pobox.com> (Graham Barr)
-
- Make lln tests and perl implementation mimic changes to looks_like_number
- in different perl versions
-
-Change 761 on 2003/02/04 by <gbarr@pobox.com> (Graham Barr)
-
- Add looks_like_number
-
-Change 760 on 2003/02/04 by <gbarr@pobox.com> (Graham Barr)
-
- Ensure PERL_DL_NONLAZY is false so we don't catch link errors during
- bootstrap and then test the perl only version
-
-Change 759 on 2002/12/12 by <gbarr@pobox.com> (Graham Barr)
-
- Release 1.09
-
-Change 758 on 2002/12/12 by <gbarr@pobox.com> (Graham Barr)
-
- Use UV to return refaddr
-
-Change 757 on 2002/11/03 by <gbarr@pobox.com> (Graham Barr)
-
- Add XS_VERSION
-
-Change 756 on 2002/11/03 by <gbarr@pobox.com> (Graham Barr)
-
- Use PAD_* macros in 5.9
- Reuse our own target when calling pp_rand in shuffle() so we dont need to create a fake pad
-
-Change 751 on 2002/10/18 by <gbarr@pobox.com> (Graham Barr)
-
- Fix context so that sub for reduce/first is always in a scalar context
- Fix sum/min/max so that they don't upgrade their arguments to NVs
- if they are IV or UV
-
-Change 750 on 2002/10/14 by <gbarr@pobox.com> (Graham Barr)
-
- Add isvstring()
-
-Change 745 on 2002/09/23 by <gbarr@pobox.com> (Graham Barr)
-
- Scalar::Util
- - Add refaddr()
-
-Change 722 on 2002/04/29 by <gbarr@pobox.com> (Graham Barr)
-
- Release 1.0701
-
-Change 721 on 2002/04/29 by <gbarr@pobox.com> (Graham Barr)
-
- Add comment to README about failing tests on perl5.6.0
-
-Change 714 on 2002/03/18 by <gbarr@pobox.com> (Graham Barr)
-
- Release 1.07
-
-Change 713 on 2002/03/18 by <gbarr@pobox.com> (Graham Barr)
-
- Add Scalar::Util::openhandle()
-
-Change 647 on 2001/09/18 by <gbarr@pobox.com> (Graham Barr)
-
- Release 1.06
-
-Change 645 on 2001/09/07 by <gbarr@pobox.com> (Graham Barr)
-
- Some platforms require the main executable to export symbols
- needed by modules. In 5.7.2 and prior releases of perl
- Perl_cxinc was not exported so we need to duplicate its
- functionality
-
-Change 644 on 2001/09/07 by <gbarr@pobox.com> (Graham Barr)
-
- Generate a typemap for NV for all perl version up to and
- including 5.006
-
-Change 643 on 2001/09/07 by <gbarr@pobox.com> (Graham Barr)
-
- Document problems known with specific versions of perl
-
-Change 642 on 2001/09/05 by <gbarr@pobox.com> (Graham Barr)
-
- Release 1.05
-
-Change 641 on 2001/09/05 by <gbarr@pobox.com> (Graham Barr)
-
- Fix shuffle() to compile with threaded perl
-
-Change 640 on 2001/09/05 by <gbarr@pobox.com> (Graham Barr)
-
- Release 1.04
-
-Change 639 on 2001/09/05 by <gbarr@pobox.com> (Graham Barr)
-
- Fix context type (caused a core on Tru64)
- Call pp_rand via *(PL_ppaddr[OP_RAND])
-
-Change 638 on 2001/09/05 by <gbarr@pobox.com> (Graham Barr)
-
- Documentation updates
-
-Change 637 on 2001/09/03 by <gbarr@pobox.com> (Graham Barr)
-
- Release 1.03
-
-Change 636 on 2001/09/03 by <gbarr@pobox.com> (Graham Barr)
-
- More changes to help merging with core dist
-
-Change 635 on 2001/09/03 by <gbarr@pobox.com> (Graham Barr)
-
- Added List::Util::shuffle() similar to that described in
- the perl FAQ except it returns a shuffled list instead of
- modifying an array passed by reference
-
-Change 632 on 2001/09/03 by <gbarr@pobox.com> (Graham Barr)
-
- Handle tied variables passed for the number to dualvar()
- Preserve number type (IV/UV/NV) in dualvar()
-
-Change 631 on 2001/08/31 by <gbarr@pobox.com> (Graham Barr)
-
- Handle eval{} inside of the code blocks for first and reduce
-
-Change 629 on 2001/08/22 by <gbarr@pobox.com> (Graham Barr)
-
- perl5.004 does not like exit from within a BEGIN, it core dumps
-
-Change 628 on 2001/08/22 by <gbarr@pobox.com> (Graham Barr)
-
- Fix stack problem in first() and reduce()
- Align with core dist
-
-Change 483 on 2000/04/10 by <gbarr@pobox.com> (Graham Barr)
-
- Release 1.02
-
-Change 482 on 2000/04/10 by <gbarr@pobox.com> (Graham Barr)
-
- Check for SvMAGICAL on argument for reftype and blessed
-
-Change 366 on 2000/03/03 by <gbarr@pobox.com> (Graham Barr)
-
- Release 1.01
-
-Change 365 on 2000/03/03 by <gbarr@pobox.com> (Graham Barr)
-
- - Added auto-detection for a compiler and install the perl version
- if not found
- - Better perl implemenation of reftype, should be thread-safe now
-
-Change 364 on 2000/03/03 by <gbarr@pobox.com> (Graham Barr)
-
- - Added some examples of simple subs that have been requested
- but not added
- - Updated copyright dates
-
-Change 344 on 1999/11/10 by <gbarr@pobox.com> (Graham Barr)
-
- - Better testcase for reftype
-
-Change 343 on 1999/11/10 by <gbarr@pobox.com> (Graham Barr)
-
- - Modules are now called List::Util & Scalar::Util
- - Supports non-XS install
- - perl version of reftype now returns "REF" when it should
-
-Change 311 on 1999/06/01 by <gbarr@pobox.com> (Graham Barr)
-
- Updated README
-
-Change 275 on 1999/03/22 by <gbarr@pobox.com> (Graham Barr)
-
- Removed forall as it is very broken
-
-Change 274 on 1999/03/22 by <gbarr@pobox.com> (Graham Barr)
-
- Added List::Util::forall
-
-Change 273 on 1999/03/21 by <gbarr@pobox.com> (Graham Barr)
-
- Added weaken and isweak to Ref::Util
-
-Change 272 on 1999/03/21 by <gbarr@pobox.com> (Graham Barr)
-
- Add new .pm files to repository
-
-Change 271 on 1999/03/21 by <gbarr@pobox.com> (Graham Barr)
-
- - Split into three packages Ref::Util, List::Util and Scalar::DualVar
- - readonly and clock were removed in favor of other modules
-
-Change 270 on 1999/03/21 by <gbarr@pobox.com> (Graham Barr)
-
- Rename package
-
-Change 269 on 1999/03/21 by <gbarr@pobox.com> (Graham Barr)
-
- - Added reftype
- - improved reduce by not doing a sub call
- - reduce now uses $a and $b
- - now compiles with 5.005_5x
-
-Change 178 on 1998/07/26 by <gbarr@pobox.com> (Graham Barr)
-
- Modified XS code so it will compile with 5.004 and 5.005
-
-Change 115 on 1998/02/21 by <gbarr@pobox.com> (Graham Barr)
-
- Fri Feb 20 1998 Graham Barr <gbarr@pobox.com>
-
- t/min.t, t/max.t
- - Change sor to do a numerical sort
-
- Fri Dec 19 1997 Graham Barr <gbarr@pobox.com>
-
- - Added readonly()
-
- Wed Nov 19 1997 Graham Barr <gbarr@pobox.com>
-
- - Initial release
-
diff --git a/ext/List-Util/ListUtil.xs b/ext/List-Util/ListUtil.xs
deleted file mode 100644
index c2f69a6b56..0000000000
--- a/ext/List-Util/ListUtil.xs
+++ /dev/null
@@ -1,613 +0,0 @@
-/* Copyright (c) 1997-2000 Graham Barr <gbarr@pobox.com>. All rights reserved.
- * This program is free software; you can redistribute it and/or
- * modify it under the same terms as Perl itself.
- */
-
-#include <EXTERN.h>
-#include <perl.h>
-#include <XSUB.h>
-
-#ifndef PERL_VERSION
-# include <patchlevel.h>
-# if !(defined(PERL_VERSION) || (SUBVERSION > 0 && defined(PATCHLEVEL)))
-# include <could_not_find_Perl_patchlevel.h>
-# endif
-# define PERL_REVISION 5
-# define PERL_VERSION PATCHLEVEL
-# define PERL_SUBVERSION SUBVERSION
-#endif
-
-#if PERL_VERSION >= 6
-# include "multicall.h"
-#endif
-
-#ifndef aTHX
-# define aTHX
-# define pTHX
-#endif
-/* Some platforms have strict exports. And before 5.7.3 cxinc (or Perl_cxinc)
- was not exported. Therefore platforms like win32, VMS etc have problems
- so we redefine it here -- GMB
-*/
-#if PERL_VERSION < 7
-/* Not in 5.6.1. */
-# define SvUOK(sv) SvIOK_UV(sv)
-# ifdef cxinc
-# undef cxinc
-# endif
-# define cxinc() my_cxinc(aTHX)
-static I32
-my_cxinc(pTHX)
-{
- cxstack_max = cxstack_max * 3 / 2;
- Renew(cxstack, cxstack_max + 1, struct context); /* XXX should fix CXINC macro */
- return cxstack_ix + 1;
-}
-#endif
-
-#if PERL_VERSION < 6
-# define NV double
-#endif
-
-#ifdef SVf_IVisUV
-# define slu_sv_value(sv) (SvIOK(sv)) ? (SvIOK_UV(sv)) ? (NV)(SvUVX(sv)) : (NV)(SvIVX(sv)) : (SvNV(sv))
-#else
-# define slu_sv_value(sv) (SvIOK(sv)) ? (NV)(SvIVX(sv)) : (SvNV(sv))
-#endif
-
-#ifndef Drand01
-# define Drand01() ((rand() & 0x7FFF) / (double) ((unsigned long)1 << 15))
-#endif
-
-#if PERL_VERSION < 5
-# ifndef gv_stashpvn
-# define gv_stashpvn(n,l,c) gv_stashpv(n,c)
-# endif
-# ifndef SvTAINTED
-
-static bool
-sv_tainted(SV *sv)
-{
- if (SvTYPE(sv) >= SVt_PVMG && SvMAGIC(sv)) {
- MAGIC *mg = mg_find(sv, 't');
- if (mg && ((mg->mg_len & 1) || (mg->mg_len & 2) && mg->mg_obj == sv))
- return TRUE;
- }
- return FALSE;
-}
-
-# define SvTAINTED_on(sv) sv_magic((sv), Nullsv, 't', Nullch, 0)
-# define SvTAINTED(sv) (SvMAGICAL(sv) && sv_tainted(sv))
-# endif
-# define PL_defgv defgv
-# define PL_op op
-# define PL_curpad curpad
-# define CALLRUNOPS runops
-# define PL_curpm curpm
-# define PL_sv_undef sv_undef
-# define PERL_CONTEXT struct context
-#endif
-#if (PERL_VERSION < 5) || (PERL_VERSION == 5 && PERL_SUBVERSION <50)
-# ifndef PL_tainting
-# define PL_tainting tainting
-# endif
-# ifndef PL_stack_base
-# define PL_stack_base stack_base
-# endif
-# ifndef PL_stack_sp
-# define PL_stack_sp stack_sp
-# endif
-# ifndef PL_ppaddr
-# define PL_ppaddr ppaddr
-# endif
-#endif
-
-#ifndef PTR2UV
-# define PTR2UV(ptr) (UV)(ptr)
-#endif
-
-#ifndef SvUV_set
-# define SvUV_set(sv, val) (((XPVUV*)SvANY(sv))->xuv_uv = (val))
-#endif
-
-#ifndef PERL_UNUSED_DECL
-# ifdef HASATTRIBUTE
-# if (defined(__GNUC__) && defined(__cplusplus)) || defined(__INTEL_COMPILER)
-# define PERL_UNUSED_DECL
-# else
-# define PERL_UNUSED_DECL __attribute__((unused))
-# endif
-# else
-# define PERL_UNUSED_DECL
-# endif
-#endif
-
-#ifndef dNOOP
-#define dNOOP extern int Perl___notused PERL_UNUSED_DECL
-#endif
-
-#ifndef dVAR
-#define dVAR dNOOP
-#endif
-
-#ifndef GvSVn
-# define GvSVn GvSV
-#endif
-
-MODULE=List::Util PACKAGE=List::Util
-
-void
-min(...)
-PROTOTYPE: @
-ALIAS:
- min = 0
- max = 1
-CODE:
-{
- int index;
- NV retval;
- SV *retsv;
- int magic;
- if(!items) {
- XSRETURN_UNDEF;
- }
- retsv = ST(0);
- magic = SvAMAGIC(retsv);
- if (!magic) {
- retval = slu_sv_value(retsv);
- }
- for(index = 1 ; index < items ; index++) {
- SV *stacksv = ST(index);
- SV *tmpsv;
- if ((magic || SvAMAGIC(stacksv)) && (tmpsv = amagic_call(retsv, stacksv, gt_amg, 0))) {
- if (SvTRUE(tmpsv) ? !ix : ix) {
- retsv = stacksv;
- magic = SvAMAGIC(retsv);
- if (!magic) {
- retval = slu_sv_value(retsv);
- }
- }
- }
- else {
- NV val = slu_sv_value(stacksv);
- if (magic) {
- retval = slu_sv_value(retsv);
- magic = 0;
- }
- if(val < retval ? !ix : ix) {
- retsv = stacksv;
- retval = val;
- }
- }
- }
- ST(0) = retsv;
- XSRETURN(1);
-}
-
-
-
-void
-sum(...)
-PROTOTYPE: @
-CODE:
-{
- SV *sv;
- SV *retsv = NULL;
- int index;
- int magic;
- NV retval = 0;
- if(!items) {
- XSRETURN_UNDEF;
- }
- sv = ST(0);
- if (SvAMAGIC(sv)) {
- retsv = sv_newmortal();
- sv_setsv(retsv, sv);
- }
- else {
- retval = slu_sv_value(sv);
- }
- for(index = 1 ; index < items ; index++) {
- sv = ST(index);
- if (retsv || SvAMAGIC(sv)) {
- if (!retsv) {
- retsv = sv_newmortal();
- sv_setnv(retsv,retval);
- }
- if (!amagic_call(retsv, sv, add_amg, AMGf_assign)) {
- sv_setnv(retsv, SvNV(retsv) + SvNV(sv));
- }
- }
- else {
- retval += slu_sv_value(sv);
- }
- }
- if (!retsv) {
- retsv = sv_newmortal();
- sv_setnv(retsv,retval);
- }
- ST(0) = retsv;
- XSRETURN(1);
-}
-
-
-void
-minstr(...)
-PROTOTYPE: @
-ALIAS:
- minstr = 2
- maxstr = 0
-CODE:
-{
- SV *left;
- int index;
- if(!items) {
- XSRETURN_UNDEF;
- }
- /*
- sv_cmp & sv_cmp_locale return 1,0,-1 for gt,eq,lt
- so we set ix to the value we are looking for
- xsubpp does not allow -ve values, so we start with 0,2 and subtract 1
- */
- ix -= 1;
- left = ST(0);
-#ifdef OPpLOCALE
- if(MAXARG & OPpLOCALE) {
- for(index = 1 ; index < items ; index++) {
- SV *right = ST(index);
- if(sv_cmp_locale(left, right) == ix)
- left = right;
- }
- }
- else {
-#endif
- for(index = 1 ; index < items ; index++) {
- SV *right = ST(index);
- if(sv_cmp(left, right) == ix)
- left = right;
- }
-#ifdef OPpLOCALE
- }
-#endif
- ST(0) = left;
- XSRETURN(1);
-}
-
-
-
-#ifdef dMULTICALL
-
-void
-reduce(block,...)
- SV * block
-PROTOTYPE: &@
-CODE:
-{
- dVAR; dMULTICALL;
- SV *ret = sv_newmortal();
- int index;
- GV *agv,*bgv,*gv;
- HV *stash;
- I32 gimme = G_SCALAR;
- SV **args = &PL_stack_base[ax];
- CV *cv;
-
- if(items <= 1) {
- XSRETURN_UNDEF;
- }
- cv = sv_2cv(block, &stash, &gv, 0);
- if (cv == Nullcv) {
- croak("Not a subroutine reference");
- }
- PUSH_MULTICALL(cv);
- agv = gv_fetchpv("a", TRUE, SVt_PV);
- bgv = gv_fetchpv("b", TRUE, SVt_PV);
- SAVESPTR(GvSV(agv));
- SAVESPTR(GvSV(bgv));
- GvSV(agv) = ret;
- SvSetSV(ret, args[1]);
- for(index = 2 ; index < items ; index++) {
- GvSV(bgv) = args[index];
- MULTICALL;
- SvSetSV(ret, *PL_stack_sp);
- }
- POP_MULTICALL;
- ST(0) = ret;
- XSRETURN(1);
-}
-
-void
-first(block,...)
- SV * block
-PROTOTYPE: &@
-CODE:
-{
- dVAR; dMULTICALL;
- int index;
- GV *gv;
- HV *stash;
- I32 gimme = G_SCALAR;
- SV **args = &PL_stack_base[ax];
- CV *cv;
-
- if(items <= 1) {
- XSRETURN_UNDEF;
- }
- cv = sv_2cv(block, &stash, &gv, 0);
- PUSH_MULTICALL(cv);
- SAVESPTR(GvSV(PL_defgv));
-
- for(index = 1 ; index < items ; index++) {
- GvSV(PL_defgv) = args[index];
- MULTICALL;
- if (SvTRUE(*PL_stack_sp)) {
- POP_MULTICALL;
- ST(0) = ST(index);
- XSRETURN(1);
- }
- }
- POP_MULTICALL;
- XSRETURN_UNDEF;
-}
-
-#endif
-
-void
-shuffle(...)
-PROTOTYPE: @
-CODE:
-{
- dVAR;
- int index;
-#if (PERL_VERSION < 9)
- struct op dmy_op;
- struct op *old_op = PL_op;
-
- /* We call pp_rand here so that Drand01 get initialized if rand()
- or srand() has not already been called
- */
- memzero((char*)(&dmy_op), sizeof(struct op));
- /* we let pp_rand() borrow the TARG allocated for this XS sub */
- dmy_op.op_targ = PL_op->op_targ;
- PL_op = &dmy_op;
- (void)*(PL_ppaddr[OP_RAND])(aTHX);
- PL_op = old_op;
-#else
- /* Initialize Drand01 if rand() or srand() has
- not already been called
- */
- if (!PL_srand_called) {
- (void)seedDrand01((Rand_seed_t)Perl_seed(aTHX));
- PL_srand_called = TRUE;
- }
-#endif
-
- for (index = items ; index > 1 ; ) {
- int swap = (int)(Drand01() * (double)(index--));
- SV *tmp = ST(swap);
- ST(swap) = ST(index);
- ST(index) = tmp;
- }
- XSRETURN(items);
-}
-
-
-MODULE=List::Util PACKAGE=Scalar::Util
-
-void
-dualvar(num,str)
- SV * num
- SV * str
-PROTOTYPE: $$
-CODE:
-{
- STRLEN len;
- char *ptr = SvPV(str,len);
- ST(0) = sv_newmortal();
- (void)SvUPGRADE(ST(0),SVt_PVNV);
- sv_setpvn(ST(0),ptr,len);
- if(SvNOK(num) || SvPOK(num) || SvMAGICAL(num)) {
- SvNV_set(ST(0), SvNV(num));
- SvNOK_on(ST(0));
- }
-#ifdef SVf_IVisUV
- else if (SvUOK(num)) {
- SvUV_set(ST(0), SvUV(num));
- SvIOK_on(ST(0));
- SvIsUV_on(ST(0));
- }
-#endif
- else {
- SvIV_set(ST(0), SvIV(num));
- SvIOK_on(ST(0));
- }
- if(PL_tainting && (SvTAINTED(num) || SvTAINTED(str)))
- SvTAINTED_on(ST(0));
- XSRETURN(1);
-}
-
-char *
-blessed(sv)
- SV * sv
-PROTOTYPE: $
-CODE:
-{
- if (SvMAGICAL(sv))
- mg_get(sv);
- if(!sv_isobject(sv)) {
- XSRETURN_UNDEF;
- }
- RETVAL = (char*)sv_reftype(SvRV(sv),TRUE);
-}
-OUTPUT:
- RETVAL
-
-char *
-reftype(sv)
- SV * sv
-PROTOTYPE: $
-CODE:
-{
- if (SvMAGICAL(sv))
- mg_get(sv);
- if(!SvROK(sv)) {
- XSRETURN_UNDEF;
- }
- RETVAL = (char*)sv_reftype(SvRV(sv),FALSE);
-}
-OUTPUT:
- RETVAL
-
-UV
-refaddr(sv)
- SV * sv
-PROTOTYPE: $
-CODE:
-{
- if (SvMAGICAL(sv))
- mg_get(sv);
- if(!SvROK(sv)) {
- XSRETURN_UNDEF;
- }
- RETVAL = PTR2UV(SvRV(sv));
-}
-OUTPUT:
- RETVAL
-
-void
-weaken(sv)
- SV *sv
-PROTOTYPE: $
-CODE:
-#ifdef SvWEAKREF
- sv_rvweaken(sv);
-#else
- croak("weak references are not implemented in this release of perl");
-#endif
-
-void
-isweak(sv)
- SV *sv
-PROTOTYPE: $
-CODE:
-#ifdef SvWEAKREF
- ST(0) = boolSV(SvROK(sv) && SvWEAKREF(sv));
- XSRETURN(1);
-#else
- croak("weak references are not implemented in this release of perl");
-#endif
-
-int
-readonly(sv)
- SV *sv
-PROTOTYPE: $
-CODE:
- RETVAL = SvREADONLY(sv);
-OUTPUT:
- RETVAL
-
-int
-tainted(sv)
- SV *sv
-PROTOTYPE: $
-CODE:
- RETVAL = SvTAINTED(sv);
-OUTPUT:
- RETVAL
-
-void
-isvstring(sv)
- SV *sv
-PROTOTYPE: $
-CODE:
-#ifdef SvVOK
- ST(0) = boolSV(SvVOK(sv));
- XSRETURN(1);
-#else
- croak("vstrings are not implemented in this release of perl");
-#endif
-
-int
-looks_like_number(sv)
- SV *sv
-PROTOTYPE: $
-CODE:
- SV *tempsv;
- if (SvAMAGIC(sv) && (tempsv = AMG_CALLun(sv, numer))) {
- sv = tempsv;
- }
- else if (SvMAGICAL(sv)) {
- SvGETMAGIC(sv);
- }
-#if (PERL_VERSION < 8) || (PERL_VERSION == 8 && PERL_SUBVERSION <5)
- if (SvPOK(sv) || SvPOKp(sv)) {
- RETVAL = looks_like_number(sv);
- }
- else {
- RETVAL = SvFLAGS(sv) & (SVf_NOK|SVp_NOK|SVf_IOK|SVp_IOK);
- }
-#else
- RETVAL = looks_like_number(sv);
-#endif
-OUTPUT:
- RETVAL
-
-void
-set_prototype(subref, proto)
- SV *subref
- SV *proto
-PROTOTYPE: &$
-CODE:
-{
- if (SvROK(subref)) {
- SV *sv = SvRV(subref);
- if (SvTYPE(sv) != SVt_PVCV) {
- /* not a subroutine reference */
- croak("set_prototype: not a subroutine reference");
- }
- if (SvPOK(proto)) {
- /* set the prototype */
- STRLEN len;
- char *ptr = SvPV(proto, len);
- sv_setpvn(sv, ptr, len);
- }
- else {
- /* delete the prototype */
- SvPOK_off(sv);
- }
- }
- else {
- croak("set_prototype: not a reference");
- }
- XSRETURN(1);
-}
-
-BOOT:
-{
- HV *lu_stash = gv_stashpvn("List::Util", 10, TRUE);
- GV *rmcgv = *(GV**)hv_fetch(lu_stash, "REAL_MULTICALL", 14, TRUE);
- SV *rmcsv;
-#if !defined(SvWEAKREF) || !defined(SvVOK)
- HV *su_stash = gv_stashpvn("Scalar::Util", 12, TRUE);
- GV *vargv = *(GV**)hv_fetch(su_stash, "EXPORT_FAIL", 11, TRUE);
- AV *varav;
- if (SvTYPE(vargv) != SVt_PVGV)
- gv_init(vargv, su_stash, "Scalar::Util", 12, TRUE);
- varav = GvAVn(vargv);
-#endif
- if (SvTYPE(rmcgv) != SVt_PVGV)
- gv_init(rmcgv, lu_stash, "List::Util", 12, TRUE);
- rmcsv = GvSVn(rmcgv);
-#ifndef SvWEAKREF
- av_push(varav, newSVpv("weaken",6));
- av_push(varav, newSVpv("isweak",6));
-#endif
-#ifndef SvVOK
- av_push(varav, newSVpv("isvstring",9));
-#endif
-#ifdef REAL_MULTICALL
- sv_setsv(rmcsv, &PL_sv_yes);
-#else
- sv_setsv(rmcsv, &PL_sv_no);
-#endif
-}
diff --git a/ext/List-Util/Makefile.PL b/ext/List-Util/Makefile.PL
deleted file mode 100644
index 1cba5abdaa..0000000000
--- a/ext/List-Util/Makefile.PL
+++ /dev/null
@@ -1,86 +0,0 @@
-# -*- perl -*-
-BEGIN { require 5.006; } # allow CPAN testers to get the point
-use strict;
-use warnings;
-use Config;
-use File::Spec;
-use ExtUtils::MakeMaker;
-my $PERL_CORE = grep { $_ eq 'PERL_CORE=1' } @ARGV;
-
-my $do_xs = $PERL_CORE || can_cc();
-
-for (@ARGV) {
- /^-pm/ and $do_xs = 0;
- /^-xs/ and $do_xs = 1;
-}
-
-WriteMakefile(
- NAME => q[List::Util],
- ABSTRACT => q[Common Scalar and List utility subroutines],
- AUTHOR => q[Graham Barr <gbarr@cpan.org>],
- DEFINE => q[-DPERL_EXT],
- DISTNAME => q[Scalar-List-Utils],
- VERSION_FROM => 'lib/List/Util.pm',
-
- # We go through the ListUtil.xs trickery to foil platforms
- # that have the feature combination of
- # (1) static builds
- # (2) allowing only one object by the same name in the static library
- # (3) the object name matching being case-blind
- # This means that we can't have the top-level util.o
- # and the extension-level Util.o in the same build.
- # One such platform is the POSIX-BC BS2000 EBCDIC mainframe platform.
- XS => {'ListUtil.xs' => 'ListUtil.c'},
- OBJECT => 'ListUtil$(OBJ_EXT)',
- ( $PERL_CORE
- ? ()
- : (
- INSTALLDIRS => q[perl],
- PREREQ_PM => {'Test::More' => 0,},
- (eval { ExtUtils::MakeMaker->VERSION(6.31) } ? (LICENSE => 'perl') : ()),
- ($do_xs ? () : (XS => {}, C => [], OBJECT => '')),
- ( eval { ExtUtils::MakeMaker->VERSION(6.46) } ? (
- META_MERGE => {
- resources => { ##
- repository => 'http://github.com/gbarr/Scalar-List-Utils',
- },
- }
- )
- : ()
- ),
- )
- ),
-);
-
-
-sub can_cc {
-
- foreach my $cmd (split(/ /, $Config::Config{cc})) {
- my $_cmd = $cmd;
- return $_cmd if (-x $_cmd or $_cmd = MM->maybe_command($_cmd));
-
- for my $dir ((split /$Config::Config{path_sep}/, $ENV{PATH}), '.') {
- my $abs = File::Spec->catfile($dir, $_[1]);
- return $abs if (-x $abs or $abs = MM->maybe_command($abs));
- }
- }
-
- return;
-}
-
-package MY;
-
-sub init_PM {
- my $self = shift;
-
- $self->SUPER::init_PM(@_);
-
- return if $do_xs;
-
- my $pm = $self->{PM};
- my $pm_file = File::Spec->catfile(qw(lib List Util XS.pm));
-
- # When installing pure perl, install XS.pp as XS.pm
- $self->{PM}{'XS.pp'} = delete $self->{PM}{$pm_file};
-}
-
diff --git a/ext/List-Util/README b/ext/List-Util/README
deleted file mode 100644
index 4fa789eb52..0000000000
--- a/ext/List-Util/README
+++ /dev/null
@@ -1,23 +0,0 @@
-This distribution is a replacement for the builtin distribution.
-
-This package contains a selection of subroutines that people have
-expressed would be nice to have in the perl core, but the usage would not
-really be high enough to warrant the use of a keyword, and the size so
-small such that being individual extensions would be wasteful.
-
-After unpacking the distribution, to install this module type
-
- perl Makefile.PL
- make
- make test
- make install
-
-KNOWN BUGS
-
-There is a bug in perl5.6.0 with UV's that are >= 1<<31. This will
-show up as tests 8 and 9 of dualvar.t failing
-
-
-Copyright (c) 1997-2006 Graham Barr <gbarr@pobox.com>. All rights reserved.
-This library is free software; you can redistribute it and/or
-modify it under the same terms as Perl itself.
diff --git a/ext/List-Util/XS.pp b/ext/List-Util/XS.pp
deleted file mode 100644
index 6521f632cd..0000000000
--- a/ext/List-Util/XS.pp
+++ /dev/null
@@ -1,45 +0,0 @@
-package List::Util::XS;
-use strict;
-use vars qw($VERSION);
-
-$VERSION = undef;
-
-sub VERSION {
- require Carp;
- Carp::croak("You need to install Scalar-List-Utils with a C compiler to ensure the XS is compiled")
- if defined $_[1];
- $VERSION;
-}
-
-1;
-__END__
-
-=head1 NAME
-
-List::Util::XS - Indicate if List::Util was compiled with a C compiler
-
-=head1 SYNOPSIS
-
- use List::Util::XS 1.20;
-
-=head1 DESCRIPTION
-
-B<*** This instalation does not have XS installed ***>
-
-C<List::Util::XS> can be used as a dependency to ensure List::Util was
-installed using a C compiler and that the XS version is installed.
-
-During installation C<$List::Util::XS::VERSION> will be set to
-C<undef> if the XS was not compiled.
-
-=head1 SEE ALSO
-
-L<Scalar::Util>, L<List::Util>, L<List::MoreUtils>
-
-=head1 COPYRIGHT
-
-Copyright (c) 2008 Graham Barr <gbarr@pobox.com>. All rights reserved.
-This program is free software; you can redistribute it and/or
-modify it under the same terms as Perl itself.
-
-=cut
diff --git a/ext/List-Util/lib/List/Util.pm b/ext/List-Util/lib/List/Util.pm
deleted file mode 100644
index 426a7a3b8d..0000000000
--- a/ext/List-Util/lib/List/Util.pm
+++ /dev/null
@@ -1,233 +0,0 @@
-# List::Util.pm
-#
-# Copyright (c) 1997-2009 Graham Barr <gbarr@pobox.com>. All rights reserved.
-# This program is free software; you can redistribute it and/or
-# modify it under the same terms as Perl itself.
-#
-# This module is normally only loaded if the XS module is not available
-
-package List::Util;
-
-use strict;
-use vars qw(@ISA @EXPORT_OK $VERSION $XS_VERSION $TESTING_PERL_ONLY);
-require Exporter;
-
-@ISA = qw(Exporter);
-@EXPORT_OK = qw(first min max minstr maxstr reduce sum shuffle);
-$VERSION = "1.21";
-$XS_VERSION = $VERSION;
-$VERSION = eval $VERSION;
-
-eval {
- # PERL_DL_NONLAZY must be false, or any errors in loading will just
- # cause the perl code to be tested
- local $ENV{PERL_DL_NONLAZY} = 0 if $ENV{PERL_DL_NONLAZY};
- eval {
- require XSLoader;
- XSLoader::load('List::Util', $XS_VERSION);
- 1;
- } or do {
- require DynaLoader;
- local @ISA = qw(DynaLoader);
- bootstrap List::Util $XS_VERSION;
- };
-} unless $TESTING_PERL_ONLY;
-
-
-if (!defined &sum) {
- require List::Util::PP;
- List::Util::PP->import;
-}
-
-1;
-
-__END__
-
-=head1 NAME
-
-List::Util - A selection of general-utility list subroutines
-
-=head1 SYNOPSIS
-
- use List::Util qw(first max maxstr min minstr reduce shuffle sum);
-
-=head1 DESCRIPTION
-
-C<List::Util> contains a selection of subroutines that people have
-expressed would be nice to have in the perl core, but the usage would
-not really be high enough to warrant the use of a keyword, and the size
-so small such that being individual extensions would be wasteful.
-
-By default C<List::Util> does not export any subroutines. The
-subroutines defined are
-
-=over 4
-
-=item first BLOCK LIST
-
-Similar to C<grep> in that it evaluates BLOCK setting C<$_> to each element
-of LIST in turn. C<first> returns the first element where the result from
-BLOCK is a true value. If BLOCK never returns true or LIST was empty then
-C<undef> is returned.
-
- $foo = first { defined($_) } @list # first defined value in @list
- $foo = first { $_ > $value } @list # first value in @list which
- # is greater than $value
-
-This function could be implemented using C<reduce> like this
-
- $foo = reduce { defined($a) ? $a : wanted($b) ? $b : undef } undef, @list
-
-for example wanted() could be defined() which would return the first
-defined value in @list
-
-=item max LIST
-
-Returns the entry in the list with the highest numerical value. If the
-list is empty then C<undef> is returned.
-
- $foo = max 1..10 # 10
- $foo = max 3,9,12 # 12
- $foo = max @bar, @baz # whatever
-
-This function could be implemented using C<reduce> like this
-
- $foo = reduce { $a > $b ? $a : $b } 1..10
-
-=item maxstr LIST
-
-Similar to C<max>, but treats all the entries in the list as strings
-and returns the highest string as defined by the C<gt> operator.
-If the list is empty then C<undef> is returned.
-
- $foo = maxstr 'A'..'Z' # 'Z'
- $foo = maxstr "hello","world" # "world"
- $foo = maxstr @bar, @baz # whatever
-
-This function could be implemented using C<reduce> like this
-
- $foo = reduce { $a gt $b ? $a : $b } 'A'..'Z'
-
-=item min LIST
-
-Similar to C<max> but returns the entry in the list with the lowest
-numerical value. If the list is empty then C<undef> is returned.
-
- $foo = min 1..10 # 1
- $foo = min 3,9,12 # 3
- $foo = min @bar, @baz # whatever
-
-This function could be implemented using C<reduce> like this
-
- $foo = reduce { $a < $b ? $a : $b } 1..10
-
-=item minstr LIST
-
-Similar to C<min>, but treats all the entries in the list as strings
-and returns the lowest string as defined by the C<lt> operator.
-If the list is empty then C<undef> is returned.
-
- $foo = minstr 'A'..'Z' # 'A'
- $foo = minstr "hello","world" # "hello"
- $foo = minstr @bar, @baz # whatever
-
-This function could be implemented using C<reduce> like this
-
- $foo = reduce { $a lt $b ? $a : $b } 'A'..'Z'
-
-=item reduce BLOCK LIST
-
-Reduces LIST by calling BLOCK, in a scalar context, multiple times,
-setting C<$a> and C<$b> each time. The first call will be with C<$a>
-and C<$b> set to the first two elements of the list, subsequent
-calls will be done by setting C<$a> to the result of the previous
-call and C<$b> to the next element in the list.
-
-Returns the result of the last call to BLOCK. If LIST is empty then
-C<undef> is returned. If LIST only contains one element then that
-element is returned and BLOCK is not executed.
-
- $foo = reduce { $a < $b ? $a : $b } 1..10 # min
- $foo = reduce { $a lt $b ? $a : $b } 'aa'..'zz' # minstr
- $foo = reduce { $a + $b } 1 .. 10 # sum
- $foo = reduce { $a . $b } @bar # concat
-
-If your algorithm requires that C<reduce> produce an identity value, then
-make sure that you always pass that identity value as the first argument to prevent
-C<undef> being returned
-
- $foo = reduce { $a + $b } 0, @values; # sum with 0 identity value
-
-=item shuffle LIST
-
-Returns the elements of LIST in a random order
-
- @cards = shuffle 0..51 # 0..51 in a random order
-
-=item sum LIST
-
-Returns the sum of all the elements in LIST. If LIST is empty then
-C<undef> is returned.
-
- $foo = sum 1..10 # 55
- $foo = sum 3,9,12 # 24
- $foo = sum @bar, @baz # whatever
-
-This function could be implemented using C<reduce> like this
-
- $foo = reduce { $a + $b } 1..10
-
-If your algorithm requires that C<sum> produce an identity of 0, then
-make sure that you always pass C<0> as the first argument to prevent
-C<undef> being returned
-
- $foo = sum 0, @values;
-
-=back
-
-=head1 KNOWN BUGS
-
-With perl versions prior to 5.005 there are some cases where reduce
-will return an incorrect result. This will show up as test 7 of
-reduce.t failing.
-
-=head1 SUGGESTED ADDITIONS
-
-The following are additions that have been requested, but I have been reluctant
-to add due to them being very simple to implement in perl
-
- # One argument is true
-
- sub any { $_ && return 1 for @_; 0 }
-
- # All arguments are true
-
- sub all { $_ || return 0 for @_; 1 }
-
- # All arguments are false
-
- sub none { $_ && return 0 for @_; 1 }
-
- # One argument is false
-
- sub notall { $_ || return 1 for @_; 0 }
-
- # How many elements are true
-
- sub true { scalar grep { $_ } @_ }
-
- # How many elements are false
-
- sub false { scalar grep { !$_ } @_ }
-
-=head1 SEE ALSO
-
-L<Scalar::Util>, L<List::MoreUtils>
-
-=head1 COPYRIGHT
-
-Copyright (c) 1997-2007 Graham Barr <gbarr@pobox.com>. All rights reserved.
-This program is free software; you can redistribute it and/or
-modify it under the same terms as Perl itself.
-
-=cut
diff --git a/ext/List-Util/lib/List/Util/PP.pm b/ext/List-Util/lib/List/Util/PP.pm
deleted file mode 100644
index 7fa2a55a21..0000000000
--- a/ext/List-Util/lib/List/Util/PP.pm
+++ /dev/null
@@ -1,75 +0,0 @@
-# List::Util::PP.pm
-#
-# Copyright (c) 1997-2009 Graham Barr <gbarr@pobox.com>. All rights reserved.
-# This program is free software; you can redistribute it and/or
-# modify it under the same terms as Perl itself.
-
-package List::Util::PP;
-
-use strict;
-use warnings;
-use vars qw(@ISA @EXPORT $VERSION $a $b);
-require Exporter;
-
-@ISA = qw(Exporter);
-@EXPORT = qw(first min max minstr maxstr reduce sum shuffle);
-$VERSION = "1.21";
-$VERSION = eval $VERSION;
-
-sub reduce (&@) {
- my $code = shift;
- unless(ref($code)) {
- require Carp;
- Carp::croak("Not a subroutine reference");
- }
- no strict 'refs';
-
- return shift unless @_ > 1;
-
- use vars qw($a $b);
-
- my $caller = caller;
- local(*{$caller."::a"}) = \my $a;
- local(*{$caller."::b"}) = \my $b;
-
- $a = shift;
- foreach (@_) {
- $b = $_;
- $a = &{$code}();
- }
-
- $a;
-}
-
-sub first (&@) {
- my $code = shift;
-
- foreach (@_) {
- return $_ if &{$code}();
- }
-
- undef;
-}
-
-
-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 shuffle (@) {
- my @a=\(@_);
- my $n;
- my $i=@_;
- map {
- $n = rand($i--);
- (${$a[$n]}, $a[$n] = $a[$i])[0];
- } @_;
-}
-
-1;
diff --git a/ext/List-Util/lib/List/Util/XS.pm b/ext/List-Util/lib/List/Util/XS.pm
deleted file mode 100644
index 01ad27ac12..0000000000
--- a/ext/List-Util/lib/List/Util/XS.pm
+++ /dev/null
@@ -1,45 +0,0 @@
-package List::Util::XS;
-use strict;
-use vars qw($VERSION);
-use List::Util;
-
-$VERSION = "1.21"; # FIXUP
-$VERSION = eval $VERSION; # FIXUP
-
-sub _VERSION { # FIXUP
- require Carp;
- Carp::croak("You need to install Scalar-List-Utils with a C compiler to ensure the XS is compiled")
- if defined $_[1];
- $VERSION;
-}
-
-1;
-__END__
-
-=head1 NAME
-
-List::Util::XS - Indicate if List::Util was compiled with a C compiler
-
-=head1 SYNOPSIS
-
- use List::Util::XS 1.20;
-
-=head1 DESCRIPTION
-
-C<List::Util::XS> can be used as a dependency to ensure List::Util was
-installed using a C compiler and that the XS version is installed.
-
-During installation C<$List::Util::XS::VERSION> will be set to
-C<undef> if the XS was not compiled.
-
-=head1 SEE ALSO
-
-L<Scalar::Util>, L<List::Util>, L<List::MoreUtils>
-
-=head1 COPYRIGHT
-
-Copyright (c) 2008 Graham Barr <gbarr@pobox.com>. All rights reserved.
-This program is free software; you can redistribute it and/or
-modify it under the same terms as Perl itself.
-
-=cut
diff --git a/ext/List-Util/lib/Scalar/Util.pm b/ext/List-Util/lib/Scalar/Util.pm
deleted file mode 100644
index db7b20c5c6..0000000000
--- a/ext/List-Util/lib/Scalar/Util.pm
+++ /dev/null
@@ -1,283 +0,0 @@
-# Scalar::Util.pm
-#
-# Copyright (c) 1997-2007 Graham Barr <gbarr@pobox.com>. All rights reserved.
-# This program is free software; you can redistribute it and/or
-# modify it under the same terms as Perl itself.
-
-package Scalar::Util;
-
-use strict;
-use vars qw(@ISA @EXPORT_OK $VERSION @EXPORT_FAIL);
-require Exporter;
-require List::Util; # List::Util loads the XS
-
-@ISA = qw(Exporter);
-@EXPORT_OK = qw(blessed dualvar reftype weaken isweak tainted readonly openhandle refaddr isvstring looks_like_number set_prototype);
-$VERSION = "1.21";
-$VERSION = eval $VERSION;
-
-unless (defined &dualvar) {
- # Load Pure Perl version if XS not loaded
- require Scalar::Util::PP;
- Scalar::Util::PP->import;
- push @EXPORT_FAIL, qw(weaken isweak dualvar isvstring set_prototype);
-}
-
-sub export_fail {
- if (grep { /dualvar/ } @EXPORT_FAIL) { # no XS loaded
- my $pat = join("|", @EXPORT_FAIL);
- if (my ($err) = grep { /^($pat)$/ } @_ ) {
- require Carp;
- Carp::croak("$err is only available with the XS version of Scalar::Util");
- }
- }
-
- if (grep { /^(weaken|isweak)$/ } @_ ) {
- require Carp;
- Carp::croak("Weak references are not implemented in the version of perl");
- }
-
- if (grep { /^(isvstring)$/ } @_ ) {
- require Carp;
- Carp::croak("Vstrings are not implemented in the version of perl");
- }
-
- @_;
-}
-
-sub openhandle ($) {
- my $fh = shift;
- my $rt = reftype($fh) || '';
-
- return defined(fileno($fh)) ? $fh : undef
- if $rt eq 'IO';
-
- if (reftype(\$fh) eq 'GLOB') { # handle openhandle(*DATA)
- $fh = \(my $tmp=$fh);
- }
- elsif ($rt ne 'GLOB') {
- return undef;
- }
-
- (tied(*$fh) or defined(fileno($fh)))
- ? $fh : undef;
-}
-
-1;
-
-__END__
-
-=head1 NAME
-
-Scalar::Util - A selection of general-utility scalar subroutines
-
-=head1 SYNOPSIS
-
- use Scalar::Util qw(blessed dualvar isweak readonly refaddr reftype tainted
- weaken isvstring looks_like_number set_prototype);
- # and other useful utils appearing below
-
-=head1 DESCRIPTION
-
-C<Scalar::Util> contains a selection of subroutines that people have
-expressed would be nice to have in the perl core, but the usage would
-not really be high enough to warrant the use of a keyword, and the size
-so small such that being individual extensions would be wasteful.
-
-By default C<Scalar::Util> does not export any subroutines. The
-subroutines defined are
-
-=over 4
-
-=item blessed EXPR
-
-If EXPR evaluates to a blessed reference the name of the package
-that it is blessed into is returned. Otherwise C<undef> is returned.
-
- $scalar = "foo";
- $class = blessed $scalar; # undef
-
- $ref = [];
- $class = blessed $ref; # undef
-
- $obj = bless [], "Foo";
- $class = blessed $obj; # "Foo"
-
-=item dualvar NUM, STRING
-
-Returns a scalar that has the value NUM in a numeric context and the
-value STRING in a string context.
-
- $foo = dualvar 10, "Hello";
- $num = $foo + 2; # 12
- $str = $foo . " world"; # Hello world
-
-=item isvstring EXPR
-
-If EXPR is a scalar which was coded as a vstring the result is true.
-
- $vs = v49.46.48;
- $fmt = isvstring($vs) ? "%vd" : "%s"; #true
- printf($fmt,$vs);
-
-=item isweak EXPR
-
-If EXPR is a scalar which is a weak reference the result is true.
-
- $ref = \$foo;
- $weak = isweak($ref); # false
- weaken($ref);
- $weak = isweak($ref); # true
-
-B<NOTE>: Copying a weak reference creates a normal, strong, reference.
-
- $copy = $ref;
- $weak = isweak($copy); # false
-
-=item looks_like_number EXPR
-
-Returns true if perl thinks EXPR is a number. See
-L<perlapi/looks_like_number>.
-
-=item openhandle FH
-
-Returns FH if FH may be used as a filehandle and is open, or FH is a tied
-handle. Otherwise C<undef> is returned.
-
- $fh = openhandle(*STDIN); # \*STDIN
- $fh = openhandle(\*STDIN); # \*STDIN
- $fh = openhandle(*NOTOPEN); # undef
- $fh = openhandle("scalar"); # undef
-
-=item readonly SCALAR
-
-Returns true if SCALAR is readonly.
-
- sub foo { readonly($_[0]) }
-
- $readonly = foo($bar); # false
- $readonly = foo(0); # true
-
-=item refaddr EXPR
-
-If EXPR evaluates to a reference the internal memory address of
-the referenced value is returned. Otherwise C<undef> is returned.
-
- $addr = refaddr "string"; # undef
- $addr = refaddr \$var; # eg 12345678
- $addr = refaddr []; # eg 23456784
-
- $obj = bless {}, "Foo";
- $addr = refaddr $obj; # eg 88123488
-
-=item reftype EXPR
-
-If EXPR evaluates to a reference the type of the variable referenced
-is returned. Otherwise C<undef> is returned.
-
- $type = reftype "string"; # undef
- $type = reftype \$var; # SCALAR
- $type = reftype []; # ARRAY
-
- $obj = bless {}, "Foo";
- $type = reftype $obj; # HASH
-
-=item set_prototype CODEREF, PROTOTYPE
-
-Sets the prototype of the given function, or deletes it if PROTOTYPE is
-undef. Returns the CODEREF.
-
- set_prototype \&foo, '$$';
-
-=item tainted EXPR
-
-Return true if the result of EXPR is tainted
-
- $taint = tainted("constant"); # false
- $taint = tainted($ENV{PWD}); # true if running under -T
-
-=item weaken REF
-
-REF will be turned into a weak reference. This means that it will not
-hold a reference count on the object it references. Also when the reference
-count on that object reaches zero, REF will be set to undef.
-
-This is useful for keeping copies of references , but you don't want to
-prevent the object being DESTROY-ed at its usual time.
-
- {
- my $var;
- $ref = \$var;
- weaken($ref); # Make $ref a weak reference
- }
- # $ref is now undef
-
-Note that if you take a copy of a scalar with a weakened reference,
-the copy will be a strong reference.
-
- my $var;
- my $foo = \$var;
- weaken($foo); # Make $foo a weak reference
- my $bar = $foo; # $bar is now a strong reference
-
-This may be less obvious in other situations, such as C<grep()>, for instance
-when grepping through a list of weakened references to objects that may have
-been destroyed already:
-
- @object = grep { defined } @object;
-
-This will indeed remove all references to destroyed objects, but the remaining
-references to objects will be strong, causing the remaining objects to never
-be destroyed because there is now always a strong reference to them in the
-@object array.
-
-=back
-
-=head1 DIAGNOSTICS
-
-Module use may give one of the following errors during import.
-
-=over
-
-=item Weak references are not implemented in the version of perl
-
-The version of perl that you are using does not implement weak references, to use
-C<isweak> or C<weaken> you will need to use a newer release of perl.
-
-=item Vstrings are not implemented in the version of perl
-
-The version of perl that you are using does not implement Vstrings, to use
-C<isvstring> you will need to use a newer release of perl.
-
-=item C<NAME> is only available with the XS version of Scalar::Util
-
-C<Scalar::Util> contains both perl and C implementations of many of its functions
-so that those without access to a C compiler may still use it. However some of the functions
-are only available when a C compiler was available to compile the XS version of the extension.
-
-At present that list is: weaken, isweak, dualvar, isvstring, set_prototype
-
-=back
-
-=head1 KNOWN BUGS
-
-There is a bug in perl5.6.0 with UV's that are >= 1<<31. This will
-show up as tests 8 and 9 of dualvar.t failing
-
-=head1 SEE ALSO
-
-L<List::Util>
-
-=head1 COPYRIGHT
-
-Copyright (c) 1997-2007 Graham Barr <gbarr@pobox.com>. All rights reserved.
-This program is free software; you can redistribute it and/or modify it
-under the same terms as Perl itself.
-
-Except weaken and isweak which are
-
-Copyright (c) 1999 Tuomas J. Lukka <lukka@iki.fi>. All rights reserved.
-This program is free software; you can redistribute it and/or modify it
-under the same terms as perl itself.
-
-=cut
diff --git a/ext/List-Util/lib/Scalar/Util/PP.pm b/ext/List-Util/lib/Scalar/Util/PP.pm
deleted file mode 100644
index 0b7f7994ba..0000000000
--- a/ext/List-Util/lib/Scalar/Util/PP.pm
+++ /dev/null
@@ -1,109 +0,0 @@
-# Scalar::Util::PP.pm
-#
-# Copyright (c) 1997-2009 Graham Barr <gbarr@pobox.com>. All rights reserved.
-# This program is free software; you can redistribute it and/or
-# modify it under the same terms as Perl itself.
-#
-# This module is normally only loaded if the XS module is not available
-
-package Scalar::Util::PP;
-
-use strict;
-use warnings;
-use vars qw(@ISA @EXPORT $VERSION $recurse);
-require Exporter;
-use B qw(svref_2object);
-
-@ISA = qw(Exporter);
-@EXPORT = qw(blessed reftype tainted readonly refaddr looks_like_number);
-$VERSION = "1.21";
-$VERSION = eval $VERSION;
-
-sub blessed ($) {
- return undef unless length(ref($_[0]));
- my $b = svref_2object($_[0]);
- return undef unless $b->isa('B::PVMG');
- my $s = $b->SvSTASH;
- return $s->isa('B::HV') ? $s->NAME : undef;
-}
-
-sub refaddr($) {
- return undef unless length(ref($_[0]));
-
- my $addr;
- if(defined(my $pkg = blessed($_[0]))) {
- $addr .= bless $_[0], 'Scalar::Util::Fake';
- bless $_[0], $pkg;
- }
- else {
- $addr .= $_[0]
- }
-
- $addr =~ /0x(\w+)/;
- local $^W;
- hex($1);
-}
-
-{
- my %tmap = qw(
- B::HV HASH
- B::AV ARRAY
- B::CV CODE
- B::IO IO
- B::NULL SCALAR
- B::NV SCALAR
- B::PV SCALAR
- B::GV GLOB
- B::RV REF
- B::REGEXP REGEXP
- );
-
- sub reftype ($) {
- my $r = shift;
-
- return undef unless length(ref($r));
-
- my $t = ref(svref_2object($r));
-
- return
- exists $tmap{$t} ? $tmap{$t}
- : length(ref($$r)) ? 'REF'
- : 'SCALAR';
- }
-}
-
-sub tainted {
- local($@, $SIG{__DIE__}, $SIG{__WARN__});
- local $^W = 0;
- no warnings;
- 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 };
-}
-
-sub looks_like_number {
- local $_ = shift;
-
- # checks from perlfaq4
- return 0 if !defined($_);
- if (ref($_)) {
- require overload;
- return overload::Overloaded($_) ? defined(0 + $_) : 0;
- }
- return 1 if (/^[+-]?\d+$/); # is a +/- integer
- return 1 if (/^([+-]?)(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?$/); # a C float
- return 1 if ($] >= 5.008 and /^(Inf(inity)?|NaN)$/i) or ($] >= 5.006001 and /^Inf$/i);
-
- 0;
-}
-
-
-1;
diff --git a/ext/List-Util/multicall.h b/ext/List-Util/multicall.h
deleted file mode 100644
index b8296e1755..0000000000
--- a/ext/List-Util/multicall.h
+++ /dev/null
@@ -1,166 +0,0 @@
-/* multicall.h (version 1.0)
- *
- * Implements a poor-man's MULTICALL interface for old versions
- * of perl that don't offer a proper one. Intended to be compatible
- * with 5.6.0 and later.
- *
- */
-
-#ifdef dMULTICALL
-#define REAL_MULTICALL
-#else
-#undef REAL_MULTICALL
-
-/* In versions of perl where MULTICALL is not defined (i.e. prior
- * to 5.9.4), Perl_pad_push is not exported either. It also has
- * an extra argument in older versions; certainly in the 5.8 series.
- * So we redefine it here.
- */
-
-#ifndef AVf_REIFY
-# ifdef SVpav_REIFY
-# define AVf_REIFY SVpav_REIFY
-# else
-# error Neither AVf_REIFY nor SVpav_REIFY is defined
-# endif
-#endif
-
-#ifndef AvFLAGS
-# define AvFLAGS SvFLAGS
-#endif
-
-static void
-multicall_pad_push(pTHX_ AV *padlist, int depth)
-{
- if (depth <= AvFILLp(padlist))
- return;
-
- {
- SV** const svp = AvARRAY(padlist);
- AV* const newpad = newAV();
- SV** const oldpad = AvARRAY(svp[depth-1]);
- I32 ix = AvFILLp((AV*)svp[1]);
- const I32 names_fill = AvFILLp((AV*)svp[0]);
- SV** const names = AvARRAY(svp[0]);
- AV *av;
-
- for ( ;ix > 0; ix--) {
- if (names_fill >= ix && names[ix] != &PL_sv_undef) {
- const char sigil = SvPVX(names[ix])[0];
- if ((SvFLAGS(names[ix]) & SVf_FAKE) || sigil == '&') {
- /* outer lexical or anon code */
- av_store(newpad, ix, SvREFCNT_inc(oldpad[ix]));
- }
- else { /* our own lexical */
- SV *sv;
- if (sigil == '@')
- sv = (SV*)newAV();
- else if (sigil == '%')
- sv = (SV*)newHV();
- else
- sv = NEWSV(0, 0);
- av_store(newpad, ix, sv);
- SvPADMY_on(sv);
- }
- }
- else if (IS_PADGV(oldpad[ix]) || IS_PADCONST(oldpad[ix])) {
- av_store(newpad, ix, SvREFCNT_inc(oldpad[ix]));
- }
- else {
- /* save temporaries on recursion? */
- SV * const sv = NEWSV(0, 0);
- av_store(newpad, ix, sv);
- SvPADTMP_on(sv);
- }
- }
- av = newAV();
- av_extend(av, 0);
- av_store(newpad, 0, (SV*)av);
- AvFLAGS(av) = AVf_REIFY;
-
- av_store(padlist, depth, (SV*)newpad);
- AvFILLp(padlist) = depth;
- }
-}
-
-#define dMULTICALL \
- SV **newsp; /* set by POPBLOCK */ \
- PERL_CONTEXT *cx; \
- CV *multicall_cv; \
- OP *multicall_cop; \
- bool multicall_oldcatch; \
- U8 hasargs = 0
-
-/* Between 5.9.1 and 5.9.2 the retstack was removed, and the
- return op is now stored on the cxstack. */
-#define HAS_RETSTACK (\
- PERL_REVISION < 5 || \
- (PERL_REVISION == 5 && PERL_VERSION < 9) || \
- (PERL_REVISION == 5 && PERL_VERSION == 9 && PERL_SUBVERSION < 2) \
-)
-
-
-/* PUSHSUB is defined so differently on different versions of perl
- * that it's easier to define our own version than code for all the
- * different possibilities.
- */
-#if HAS_RETSTACK
-# define PUSHSUB_RETSTACK(cx)
-#else
-# define PUSHSUB_RETSTACK(cx) cx->blk_sub.retop = Nullop;
-#endif
-#define MULTICALL_PUSHSUB(cx, the_cv) \
- cx->blk_sub.cv = the_cv; \
- cx->blk_sub.olddepth = CvDEPTH(the_cv); \
- cx->blk_sub.hasargs = hasargs; \
- cx->blk_sub.lval = PL_op->op_private & \
- (OPpLVAL_INTRO|OPpENTERSUB_INARGS); \
- PUSHSUB_RETSTACK(cx) \
- if (!CvDEPTH(the_cv)) { \
- (void)SvREFCNT_inc(the_cv); \
- (void)SvREFCNT_inc(the_cv); \
- SAVEFREESV(the_cv); \
- }
-
-#define PUSH_MULTICALL(the_cv) \
- STMT_START { \
- CV *_nOnclAshIngNamE_ = the_cv; \
- AV* padlist = CvPADLIST(_nOnclAshIngNamE_); \
- multicall_cv = _nOnclAshIngNamE_; \
- ENTER; \
- multicall_oldcatch = CATCH_GET; \
- SAVESPTR(CvROOT(multicall_cv)->op_ppaddr); \
- CvROOT(multicall_cv)->op_ppaddr = PL_ppaddr[OP_NULL]; \
- SAVETMPS; SAVEVPTR(PL_op); \
- CATCH_SET(TRUE); \
- PUSHSTACKi(PERLSI_SORT); \
- PUSHBLOCK(cx, CXt_SUB, PL_stack_sp); \
- MULTICALL_PUSHSUB(cx, multicall_cv); \
- if (++CvDEPTH(multicall_cv) >= 2) { \
- PERL_STACK_OVERFLOW_CHECK(); \
- multicall_pad_push(aTHX_ padlist, CvDEPTH(multicall_cv)); \
- } \
- SAVECOMPPAD(); \
- PL_comppad = (AV*) (AvARRAY(padlist)[CvDEPTH(multicall_cv)]); \
- PL_curpad = AvARRAY(PL_comppad); \
- multicall_cop = CvSTART(multicall_cv); \
- } STMT_END
-
-#define MULTICALL \
- STMT_START { \
- PL_op = multicall_cop; \
- CALLRUNOPS(aTHX); \
- } STMT_END
-
-#define POP_MULTICALL \
- STMT_START { \
- CvDEPTH(multicall_cv)--; \
- LEAVESUB(multicall_cv); \
- POPBLOCK(cx,PL_curpm); \
- POPSTACK; \
- CATCH_SET(multicall_oldcatch); \
- LEAVE; \
- SPAGAIN; \
- } STMT_END
-
-#endif
diff --git a/ext/List-Util/t/00version.t b/ext/List-Util/t/00version.t
deleted file mode 100644
index d475de488d..0000000000
--- a/ext/List-Util/t/00version.t
+++ /dev/null
@@ -1,25 +0,0 @@
-#!./perl
-
-BEGIN {
- unless (-d 'blib') {
- chdir 't' if -d 't';
- @INC = '../lib';
- require Config; import Config;
- keys %Config; # Silence warning
- if ($Config{extensions} !~ /\bList\/Util\b/) {
- print "1..0 # Skip: List::Util was not built\n";
- exit 0;
- }
- }
-}
-
-use Scalar::Util ();
-use List::Util ();
-use List::Util::XS ();
-use Test::More tests => 2;
-
-is( $Scalar::Util::VERSION, $List::Util::VERSION, "VERSION mismatch");
-my $has_xs = eval { Scalar::Util->import('dualvar'); 1 };
-my $xs_version = $has_xs ? $List::Util::VERSION : undef;
-is( $List::Util::XS::VERSION, $xs_version, "XS VERSION");
-
diff --git a/ext/List-Util/t/blessed.t b/ext/List-Util/t/blessed.t
deleted file mode 100644
index f0a4c19b25..0000000000
--- a/ext/List-Util/t/blessed.t
+++ /dev/null
@@ -1,54 +0,0 @@
-#!./perl
-
-BEGIN {
- unless (-d 'blib') {
- chdir 't' if -d 't';
- @INC = '../lib';
- require Config; import Config;
- keys %Config; # Silence warning
- if ($Config{extensions} !~ /\bList\/Util\b/) {
- print "1..0 # Skip: List::Util was not built\n";
- exit 0;
- }
- }
-}
-
-use Test::More tests => 11;
-use Scalar::Util qw(blessed);
-use vars qw($t $x);
-
-ok(!blessed(undef), 'undef is not blessed');
-ok(!blessed(1), 'Numbers are not blessed');
-ok(!blessed('A'), 'Strings are not blessed');
-ok(!blessed({}), 'Unblessed HASH-ref');
-ok(!blessed([]), 'Unblessed ARRAY-ref');
-ok(!blessed(\$t), 'Unblessed SCALAR-ref');
-
-$x = bless [], "ABC";
-is(blessed($x), "ABC", 'blessed ARRAY-ref');
-
-$x = bless {}, "DEF";
-is(blessed($x), "DEF", 'blessed HASH-ref');
-
-$x = bless {}, "0";
-cmp_ok(blessed($x), "eq", "0", 'blessed HASH-ref');
-
-{
- my $depth;
- {
- no warnings 'redefine';
- *UNIVERSAL::can = sub { die "Burp!" if ++$depth > 2; blessed(shift) };
- }
- $x = bless {}, "DEF";
- is(blessed($x), "DEF", 'recursion of UNIVERSAL::can');
-}
-
-{
- package Broken;
- sub isa { die };
- sub can { die };
-
- my $obj = bless [], __PACKAGE__;
- ::is( ::blessed($obj), __PACKAGE__, "blessed on broken isa() and can()" );
-}
-
diff --git a/ext/List-Util/t/dualvar.t b/ext/List-Util/t/dualvar.t
deleted file mode 100644
index fab3691a32..0000000000
--- a/ext/List-Util/t/dualvar.t
+++ /dev/null
@@ -1,61 +0,0 @@
-#!./perl
-
-BEGIN {
- unless (-d 'blib') {
- chdir 't' if -d 't';
- @INC = '../lib';
- require Config; import Config;
- keys %Config; # Silence warning
- if ($Config{extensions} !~ /\bList\/Util\b/) {
- print "1..0 # Skip: List::Util was not built\n";
- exit 0;
- }
- }
-}
-
-use Scalar::Util ();
-use Test::More (grep { /dualvar/ } @Scalar::Util::EXPORT_FAIL)
- ? (skip_all => 'dualvar requires XS version')
- : (tests => 11);
-
-Scalar::Util->import('dualvar');
-
-$var = dualvar( 2.2,"string");
-
-ok( $var == 2.2, 'Numeric value');
-ok( $var eq "string", 'String value');
-
-$var2 = $var;
-
-ok( $var2 == 2.2, 'copy Numeric value');
-ok( $var2 eq "string", 'copy String value');
-
-$var++;
-
-ok( $var == 3.2, 'inc Numeric value');
-ok( $var ne "string", 'inc String value');
-
-my $numstr = "10.2";
-my $numtmp = int($numstr); # use $numstr as an int
-
-$var = dualvar($numstr, "");
-
-ok( $var == $numstr, 'NV');
-
-SKIP: {
- skip("dualvar with UV value known to fail with $]",2) if $] < 5.006_001;
- $var = dualvar(1<<31, "");
- ok( $var == (1<<31), 'UV 1');
- ok( $var > 0, 'UV 2');
-}
-
-tie my $tied, 'Tied';
-$var = dualvar($tied, "ok");
-ok($var == 7.5, 'Tied num');
-ok($var eq 'ok', 'Tied str');
-
-package Tied;
-
-sub TIESCALAR { bless {} }
-sub FETCH { 7.5 }
-
diff --git a/ext/List-Util/t/expfail.t b/ext/List-Util/t/expfail.t
deleted file mode 100644
index 02fc192f14..0000000000
--- a/ext/List-Util/t/expfail.t
+++ /dev/null
@@ -1,29 +0,0 @@
-#!./perl
-
-BEGIN {
- unless (-d 'blib') {
- chdir 't' if -d 't';
- @INC = '../lib';
- require Config; import Config;
- keys %Config; # Silence warning
- if ($Config{extensions} !~ /\bList\/Util\b/) {
- print "1..0 # Skip: List::Util was not built\n";
- exit 0;
- }
- }
-}
-
-use Test::More tests => 3;
-use strict;
-
-$List::Util::TESTING_PERL_ONLY = $List::Util::TESTING_PERL_ONLY = 1;
-require Scalar::Util;
-
-for my $func (qw(dualvar set_prototype weaken)) {
- eval { Scalar::Util->import($func); };
- like(
- $@,
- qr/$func is only available with the XS/,
- "no pure perl $func: error raised",
- );
-}
diff --git a/ext/List-Util/t/first.t b/ext/List-Util/t/first.t
deleted file mode 100644
index 07377ab340..0000000000
--- a/ext/List-Util/t/first.t
+++ /dev/null
@@ -1,115 +0,0 @@
-#!./perl
-
-BEGIN {
- unless (-d 'blib') {
- chdir 't' if -d 't';
- @INC = '../lib';
- require Config; import Config;
- keys %Config; # Silence warning
- if ($Config{extensions} !~ /\bList\/Util\b/) {
- print "1..0 # Skip: List::Util was not built\n";
- exit 0;
- }
- }
-}
-
-use List::Util qw(first);
-use Test::More;
-plan tests => ($::PERL_ONLY ? 15 : 17);
-my $v;
-
-ok(defined &first, 'defined');
-
-$v = first { 8 == ($_ - 1) } 9,4,5,6;
-is($v, 9, 'one more than 8');
-
-$v = first { 0 } 1,2,3,4;
-is($v, undef, 'none match');
-
-$v = first { 0 };
-is($v, undef, 'no args');
-
-$v = first { $_->[1] le "e" and "e" le $_->[2] }
- [qw(a b c)], [qw(d e f)], [qw(g h i)];
-is_deeply($v, [qw(d e f)], 'reference args');
-
-# Check that eval{} inside the block works correctly
-my $i = 0;
-$v = first { eval { die }; ($i == 5, $i = $_)[0] } 0,1,2,3,4,5,5;
-is($v, 5, 'use of eval');
-
-$v = eval { first { die if $_ } 0,0,1 };
-is($v, undef, 'use of die');
-
-sub foobar { first { !defined(wantarray) || wantarray } "not ","not ","not " }
-
-($v) = foobar();
-is($v, undef, 'wantarray');
-
-# Can we leave the sub with 'return'?
-$v = first {return ($_>6)} 2,4,6,12;
-is($v, 12, 'return');
-
-# ... even in a loop?
-$v = first {while(1) {return ($_>6)} } 2,4,6,12;
-is($v, 12, 'return from loop');
-
-# Does it work from another package?
-{ package Foo;
- ::is(List::Util::first(sub{$_>4},(1..4,24)), 24, 'other package');
-}
-
-# Can we undefine a first sub while it's running?
-sub self_immolate {undef &self_immolate; 1}
-eval { $v = first \&self_immolate, 1,2; };
-like($@, qr/^Can't undef active subroutine/, "undef active sub");
-
-# Redefining an active sub should not fail, but whether the
-# redefinition takes effect immediately depends on whether we're
-# running the Perl or XS implementation.
-
-sub self_updating { local $^W; *self_updating = sub{1} ;1}
-eval { $v = first \&self_updating, 1,2; };
-is($@, '', 'redefine self');
-
-{ my $failed = 0;
-
- sub rec { my $n = shift;
- if (!defined($n)) { # No arg means we're being called by first()
- return 1; }
- if ($n<5) { rec($n+1); }
- else { $v = first \&rec, 1,2; }
- $failed = 1 if !defined $n;
- }
-
- rec(1);
- ok(!$failed, 'from active sub');
-}
-
-# Calling a sub from first should leave its refcount unchanged.
-SKIP: {
- skip("No Internals::SvREFCNT", 1) if !defined &Internals::SvREFCNT;
- sub huge {$_>1E6}
- my $refcnt = &Internals::SvREFCNT(\&huge);
- $v = first \&huge, 1..6;
- is(&Internals::SvREFCNT(\&huge), $refcnt, "Refcount unchanged");
-}
-
-# The remainder of the tests are only relevant for the XS
-# implementation. The Perl-only implementation behaves differently
-# (and more flexibly) in a way that we can't emulate from XS.
-if (!$::PERL_ONLY) { SKIP: {
-
- $List::Util::REAL_MULTICALL ||= 0; # Avoid use only once
- skip("Poor man's MULTICALL can't cope", 2)
- if !$List::Util::REAL_MULTICALL;
-
- # Can we goto a label from the 'first' sub?
- eval {()=first{goto foo} 1,2; foo: 1};
- like($@, qr/^Can't "goto" out of a pseudo block/, "goto label");
-
- # Can we goto a subroutine?
- eval {()=first{goto sub{}} 1,2;};
- like($@, qr/^Can't goto subroutine from a sort sub/, "goto sub");
-
-} }
diff --git a/ext/List-Util/t/isvstring.t b/ext/List-Util/t/isvstring.t
deleted file mode 100644
index 860113e067..0000000000
--- a/ext/List-Util/t/isvstring.t
+++ /dev/null
@@ -1,33 +0,0 @@
-#!./perl
-
-BEGIN {
- unless (-d 'blib') {
- chdir 't' if -d 't';
- @INC = '../lib';
- require Config; import Config;
- keys %Config; # Silence warning
- if ($Config{extensions} !~ /\bList\/Util\b/) {
- print "1..0 # Skip: List::Util was not built\n";
- exit 0;
- }
- }
-}
-
-$|=1;
-use Scalar::Util ();
-use Test::More (grep { /isvstring/ } @Scalar::Util::EXPORT_FAIL)
- ? (skip_all => 'isvstring requires XS version')
- : (tests => 3);
-
-Scalar::Util->import(qw[isvstring]);
-
-$vs = ord("A") == 193 ? 241.75.240 : 49.46.48;
-
-ok( $vs == "1.0", 'dotted num');
-ok( isvstring($vs), 'isvstring');
-
-$sv = "1.0";
-ok( !isvstring($sv), 'not isvstring');
-
-
-
diff --git a/ext/List-Util/t/lln.t b/ext/List-Util/t/lln.t
deleted file mode 100644
index d31633be6f..0000000000
--- a/ext/List-Util/t/lln.t
+++ /dev/null
@@ -1,46 +0,0 @@
-#!/usr/bin/perl -w
-
-BEGIN {
- unless (-d 'blib') {
- chdir 't' if -d 't';
- @INC = '../lib';
- require Config; import Config;
- keys %Config; # Silence warning
- if ($Config{extensions} !~ /\bList\/Util\b/) {
- print "1..0 # Skip: List::Util was not built\n";
- exit 0;
- }
- }
-}
-
-use strict;
-use Test::More tests => 18;
-use Scalar::Util qw(looks_like_number);
-
-foreach my $num (qw(1 -1 +1 1.0 +1.0 -1.0 -1.0e-12)) {
- ok(looks_like_number($num), "'$num'");
-}
-
-is(!!looks_like_number("Inf"), $] >= 5.006001, 'Inf');
-is(!!looks_like_number("Infinity"), $] >= 5.008, 'Infinity');
-is(!!looks_like_number("NaN"), $] >= 5.008, 'NaN');
-is(!!looks_like_number("foo"), '', 'foo');
-is(!!looks_like_number(undef), '', 'undef');
-is(!!looks_like_number({}), '', 'HASH Ref');
-is(!!looks_like_number([]), '', 'ARRAY Ref');
-
-use Math::BigInt;
-my $bi = Math::BigInt->new('1234567890');
-is(!!looks_like_number($bi), 1, 'Math::BigInt');
-is(!!looks_like_number("$bi"), 1, 'Stringified Math::BigInt');
-
-{ package Foo;
-sub TIEHASH { bless {} }
-sub FETCH { $_[1] }
-}
-my %foo;
-tie %foo, 'Foo';
-is(!!looks_like_number($foo{'abc'}), '', 'Tied');
-is(!!looks_like_number($foo{'123'}), 1, 'Tied');
-
-# We should copy some of perl core tests like t/base/num.t here
diff --git a/ext/List-Util/t/max.t b/ext/List-Util/t/max.t
deleted file mode 100644
index a98219897c..0000000000
--- a/ext/List-Util/t/max.t
+++ /dev/null
@@ -1,69 +0,0 @@
-#!./perl
-
-BEGIN {
- unless (-d 'blib') {
- chdir 't' if -d 't';
- @INC = '../lib';
- require Config; import Config;
- keys %Config; # Silence warning
- if ($Config{extensions} !~ /\bList\/Util\b/) {
- print "1..0 # Skip: List::Util was not built\n";
- exit 0;
- }
- }
-}
-
-use strict;
-use Test::More tests => 8;
-use List::Util qw(max);
-
-my $v;
-
-ok(defined &max, 'defined');
-
-$v = max(1);
-is($v, 1, 'single arg');
-
-$v = max (1,2);
-is($v, 2, '2-arg ordered');
-
-$v = max(2,1);
-is($v, 2, '2-arg reverse ordered');
-
-my @a = map { rand() } 1 .. 20;
-my @b = sort { $a <=> $b } @a;
-$v = max(@a);
-is($v, $b[-1], '20-arg random order');
-
-my $one = Foo->new(1);
-my $two = Foo->new(2);
-my $thr = Foo->new(3);
-
-$v = max($one,$two,$thr);
-is($v, 3, 'overload');
-
-$v = max($thr,$two,$one);
-is($v, 3, 'overload');
-
-{ package Foo;
-
-use overload
- '""' => sub { ${$_[0]} },
- '+0' => sub { ${$_[0]} },
- fallback => 1;
- sub new {
- my $class = shift;
- my $value = shift;
- bless \$value, $class;
- }
-}
-
-SKIP: {
- eval { require bignum; } or skip("Need bignum for testing overloading",1);
-
- my $v1 = 2**65;
- my $v2 = $v1 - 1;
- my $v3 = $v2 - 1;
- $v = max($v1,$v2,$v1,$v3,$v1);
- is($v, $v1, 'bigint');
-}
diff --git a/ext/List-Util/t/maxstr.t b/ext/List-Util/t/maxstr.t
deleted file mode 100644
index 11d98ff558..0000000000
--- a/ext/List-Util/t/maxstr.t
+++ /dev/null
@@ -1,36 +0,0 @@
-#!./perl
-
-BEGIN {
- unless (-d 'blib') {
- chdir 't' if -d 't';
- @INC = '../lib';
- require Config; import Config;
- keys %Config; # Silence warning
- if ($Config{extensions} !~ /\bList\/Util\b/) {
- print "1..0 # Skip: List::Util was not built\n";
- exit 0;
- }
- }
-}
-
-use strict;
-use Test::More tests => 5;
-use List::Util qw(maxstr);
-
-my $v;
-
-ok(defined &maxstr, 'defined');
-
-$v = maxstr('a');
-is($v, 'a', 'single arg');
-
-$v = maxstr('a','b');
-is($v, 'b', '2-arg ordered');
-
-$v = maxstr('B','A');
-is($v, 'B', '2-arg reverse ordered');
-
-my @a = map { pack("u", pack("C*",map { int(rand(256))} (0..int(rand(10) + 2)))) } 0 .. 20;
-my @b = sort { $a cmp $b } @a;
-$v = maxstr(@a);
-is($v, $b[-1], 'random ordered');
diff --git a/ext/List-Util/t/min.t b/ext/List-Util/t/min.t
deleted file mode 100644
index eb8c1b9c70..0000000000
--- a/ext/List-Util/t/min.t
+++ /dev/null
@@ -1,69 +0,0 @@
-#!./perl
-
-BEGIN {
- unless (-d 'blib') {
- chdir 't' if -d 't';
- @INC = '../lib';
- require Config; import Config;
- keys %Config; # Silence warning
- if ($Config{extensions} !~ /\bList\/Util\b/) {
- print "1..0 # Skip: List::Util was not built\n";
- exit 0;
- }
- }
-}
-
-use strict;
-use Test::More tests => 8;
-use List::Util qw(min);
-
-my $v;
-
-ok(defined &min, 'defined');
-
-$v = min(9);
-is($v, 9, 'single arg');
-
-$v = min (1,2);
-is($v, 1, '2-arg ordered');
-
-$v = min(2,1);
-is($v, 1, '2-arg reverse ordered');
-
-my @a = map { rand() } 1 .. 20;
-my @b = sort { $a <=> $b } @a;
-$v = min(@a);
-is($v, $b[0], '20-arg random order');
-
-my $one = Foo->new(1);
-my $two = Foo->new(2);
-my $thr = Foo->new(3);
-
-$v = min($one,$two,$thr);
-is($v, 1, 'overload');
-
-$v = min($thr,$two,$one);
-is($v, 1, 'overload');
-
-{ package Foo;
-
-use overload
- '""' => sub { ${$_[0]} },
- '+0' => sub { ${$_[0]} },
- fallback => 1;
- sub new {
- my $class = shift;
- my $value = shift;
- bless \$value, $class;
- }
-}
-
-SKIP: {
- eval { require bignum; } or skip("Need bignum for testing overloading",1);
-
- my $v1 = 2**65;
- my $v2 = $v1 - 1;
- my $v3 = $v2 - 1;
- $v = min($v1,$v2,$v1,$v3,$v1);
- is($v, $v3, 'bigint');
-}
diff --git a/ext/List-Util/t/minstr.t b/ext/List-Util/t/minstr.t
deleted file mode 100644
index 021b309dad..0000000000
--- a/ext/List-Util/t/minstr.t
+++ /dev/null
@@ -1,36 +0,0 @@
-#!./perl
-
-BEGIN {
- unless (-d 'blib') {
- chdir 't' if -d 't';
- @INC = '../lib';
- require Config; import Config;
- keys %Config; # Silence warning
- if ($Config{extensions} !~ /\bList\/Util\b/) {
- print "1..0 # Skip: List::Util was not built\n";
- exit 0;
- }
- }
-}
-
-use strict;
-use Test::More tests => 5;
-use List::Util qw(minstr);
-
-my $v;
-
-ok(defined &minstr, 'defined');
-
-$v = minstr('a');
-is($v, 'a', 'single arg');
-
-$v = minstr('a','b');
-is($v, 'a', '2-arg ordered');
-
-$v = minstr('B','A');
-is($v, 'A', '2-arg reverse ordered');
-
-my @a = map { pack("u", pack("C*",map { int(rand(256))} (0..int(rand(10) + 2)))) } 0 .. 20;
-my @b = sort { $a cmp $b } @a;
-$v = minstr(@a);
-is($v, $b[0], 'random ordered');
diff --git a/ext/List-Util/t/openhan.t b/ext/List-Util/t/openhan.t
deleted file mode 100644
index bf4e6c16f8..0000000000
--- a/ext/List-Util/t/openhan.t
+++ /dev/null
@@ -1,89 +0,0 @@
-#!./perl
-
-BEGIN {
- unless (-d 'blib') {
- chdir 't' if -d 't';
- @INC = '../lib';
- require Config; import Config;
- keys %Config; # Silence warning
- if ($Config{extensions} !~ /\bList\/Util\b/) {
- print "1..0 # Skip: List::Util was not built\n";
- exit 0;
- }
- }
-}
-
-use strict;
-
-use Test::More tests => 14;
-use Scalar::Util qw(openhandle);
-
-ok(defined &openhandle, 'defined');
-
-{
- my $fh = \*STDERR;
- is(openhandle($fh), $fh, 'STDERR');
-
- is(fileno(openhandle(*STDERR)), fileno(STDERR), 'fileno(STDERR)');
-}
-
-{
- use vars qw(*CLOSED);
- is(openhandle(*CLOSED), undef, 'closed');
-}
-
-SKIP: {
- skip "3-arg open only on 5.6 or later", 1 if $]<5.006;
-
- open my $fh, "<", $0;
- skip "could not open $0 for reading: $!", 1 unless $fh;
- is(openhandle($fh), $fh, "works with indirect filehandles");
-}
-
-SKIP: {
- skip "in-memory files only on 5.8 or later", 1 if $]<5.008;
-
- open my $fh, "<", \"in-memory file";
- skip "could not open in-memory file: $!", 1 unless $fh;
- is(openhandle($fh), $fh, "works with in-memory files");
-}
-
-ok(openhandle(\*DATA), "works for \*DATA");
-ok(openhandle(*DATA), "works for *DATA");
-ok(openhandle(*DATA{IO}), "works for *DATA{IO}");
-
-{
- require IO::Handle;
- my $fh = IO::Handle->new_from_fd(fileno(*STDERR), 'w');
- skip "new_from_fd(fileno(*STDERR)) failed", 1 unless $fh;
- ok(openhandle($fh), "works for IO::Handle objects");
-
- ok(!openhandle(IO::Handle->new), "unopened IO::Handle");
-}
-
-{
- require IO::File;
- my $fh = IO::File->new;
- $fh->open("< $0")
- or skip "could not open $0: $!", 1;
- ok(openhandle($fh), "works for IO::File objects");
-
- ok(!openhandle(IO::File->new), "unopened IO::File" );
-}
-
-SKIP: {
- skip( "Tied handles only on 5.8 or later", 1) if $]<5.008;
-
- use vars qw(*H);
-
- package My::Tie;
- require Tie::Handle;
- @My::Tie::ISA = qw(Tie::Handle);
- sub TIEHANDLE { bless {} }
-
- package main;
- tie *H, 'My::Tie';
- ok(openhandle(*H), "tied handles are always ok");
-}
-
-__DATA__
diff --git a/ext/List-Util/t/p_00version.t b/ext/List-Util/t/p_00version.t
deleted file mode 100644
index 0b64f9eef3..0000000000
--- a/ext/List-Util/t/p_00version.t
+++ /dev/null
@@ -1,26 +0,0 @@
-#!./perl
-
-BEGIN {
- unless (-d 'blib') {
- chdir 't' if -d 't';
- @INC = '../lib';
- require Config; import Config;
- keys %Config; # Silence warning
- if ($Config{extensions} !~ /\bList\/Util\b/) {
- print "1..0 # Skip: List::Util was not built\n";
- exit 0;
- }
- }
-}
-
-use Test::More tests => 2;
-
-# force perl-only version to be tested
-$List::Util::TESTING_PERL_ONLY = $List::Util::TESTING_PERL_ONLY = 1;
-
-require Scalar::Util;
-require List::Util;
-
-is( $Scalar::Util::PP::VERSION, $List::Util::VERSION, "VERSION mismatch");
-is( $List::Util::PP::VERSION, $List::Util::VERSION, "VERSION mismatch");
-
diff --git a/ext/List-Util/t/p_blessed.t b/ext/List-Util/t/p_blessed.t
deleted file mode 100644
index 48e7ef7dcd..0000000000
--- a/ext/List-Util/t/p_blessed.t
+++ /dev/null
@@ -1,7 +0,0 @@
-#!./perl
-
-# force perl-only version to be tested
-$List::Util::TESTING_PERL_ONLY = $List::Util::TESTING_PERL_ONLY = 1;
-
-(my $f = __FILE__) =~ s/p_//;
-do $f; die $@ if $@;
diff --git a/ext/List-Util/t/p_first.t b/ext/List-Util/t/p_first.t
deleted file mode 100644
index cd39ec44be..0000000000
--- a/ext/List-Util/t/p_first.t
+++ /dev/null
@@ -1,8 +0,0 @@
-#!./perl
-
-# force perl-only version to be tested
-$List::Util::TESTING_PERL_ONLY = $List::Util::TESTING_PERL_ONLY = 1;
-
-(my $f = __FILE__) =~ s/p_//;
-$::PERL_ONLY = $::PERL_ONLY = 1; # Mustn't use it only once!
-do $f; die $@ if $@;
diff --git a/ext/List-Util/t/p_lln.t b/ext/List-Util/t/p_lln.t
deleted file mode 100644
index 48e7ef7dcd..0000000000
--- a/ext/List-Util/t/p_lln.t
+++ /dev/null
@@ -1,7 +0,0 @@
-#!./perl
-
-# force perl-only version to be tested
-$List::Util::TESTING_PERL_ONLY = $List::Util::TESTING_PERL_ONLY = 1;
-
-(my $f = __FILE__) =~ s/p_//;
-do $f; die $@ if $@;
diff --git a/ext/List-Util/t/p_max.t b/ext/List-Util/t/p_max.t
deleted file mode 100644
index 48e7ef7dcd..0000000000
--- a/ext/List-Util/t/p_max.t
+++ /dev/null
@@ -1,7 +0,0 @@
-#!./perl
-
-# force perl-only version to be tested
-$List::Util::TESTING_PERL_ONLY = $List::Util::TESTING_PERL_ONLY = 1;
-
-(my $f = __FILE__) =~ s/p_//;
-do $f; die $@ if $@;
diff --git a/ext/List-Util/t/p_maxstr.t b/ext/List-Util/t/p_maxstr.t
deleted file mode 100644
index 48e7ef7dcd..0000000000
--- a/ext/List-Util/t/p_maxstr.t
+++ /dev/null
@@ -1,7 +0,0 @@
-#!./perl
-
-# force perl-only version to be tested
-$List::Util::TESTING_PERL_ONLY = $List::Util::TESTING_PERL_ONLY = 1;
-
-(my $f = __FILE__) =~ s/p_//;
-do $f; die $@ if $@;
diff --git a/ext/List-Util/t/p_min.t b/ext/List-Util/t/p_min.t
deleted file mode 100644
index 48e7ef7dcd..0000000000
--- a/ext/List-Util/t/p_min.t
+++ /dev/null
@@ -1,7 +0,0 @@
-#!./perl
-
-# force perl-only version to be tested
-$List::Util::TESTING_PERL_ONLY = $List::Util::TESTING_PERL_ONLY = 1;
-
-(my $f = __FILE__) =~ s/p_//;
-do $f; die $@ if $@;
diff --git a/ext/List-Util/t/p_minstr.t b/ext/List-Util/t/p_minstr.t
deleted file mode 100644
index 48e7ef7dcd..0000000000
--- a/ext/List-Util/t/p_minstr.t
+++ /dev/null
@@ -1,7 +0,0 @@
-#!./perl
-
-# force perl-only version to be tested
-$List::Util::TESTING_PERL_ONLY = $List::Util::TESTING_PERL_ONLY = 1;
-
-(my $f = __FILE__) =~ s/p_//;
-do $f; die $@ if $@;
diff --git a/ext/List-Util/t/p_openhan.t b/ext/List-Util/t/p_openhan.t
deleted file mode 100644
index 48e7ef7dcd..0000000000
--- a/ext/List-Util/t/p_openhan.t
+++ /dev/null
@@ -1,7 +0,0 @@
-#!./perl
-
-# force perl-only version to be tested
-$List::Util::TESTING_PERL_ONLY = $List::Util::TESTING_PERL_ONLY = 1;
-
-(my $f = __FILE__) =~ s/p_//;
-do $f; die $@ if $@;
diff --git a/ext/List-Util/t/p_readonly.t b/ext/List-Util/t/p_readonly.t
deleted file mode 100644
index 48e7ef7dcd..0000000000
--- a/ext/List-Util/t/p_readonly.t
+++ /dev/null
@@ -1,7 +0,0 @@
-#!./perl
-
-# force perl-only version to be tested
-$List::Util::TESTING_PERL_ONLY = $List::Util::TESTING_PERL_ONLY = 1;
-
-(my $f = __FILE__) =~ s/p_//;
-do $f; die $@ if $@;
diff --git a/ext/List-Util/t/p_reduce.t b/ext/List-Util/t/p_reduce.t
deleted file mode 100644
index cd39ec44be..0000000000
--- a/ext/List-Util/t/p_reduce.t
+++ /dev/null
@@ -1,8 +0,0 @@
-#!./perl
-
-# force perl-only version to be tested
-$List::Util::TESTING_PERL_ONLY = $List::Util::TESTING_PERL_ONLY = 1;
-
-(my $f = __FILE__) =~ s/p_//;
-$::PERL_ONLY = $::PERL_ONLY = 1; # Mustn't use it only once!
-do $f; die $@ if $@;
diff --git a/ext/List-Util/t/p_refaddr.t b/ext/List-Util/t/p_refaddr.t
deleted file mode 100644
index 48e7ef7dcd..0000000000
--- a/ext/List-Util/t/p_refaddr.t
+++ /dev/null
@@ -1,7 +0,0 @@
-#!./perl
-
-# force perl-only version to be tested
-$List::Util::TESTING_PERL_ONLY = $List::Util::TESTING_PERL_ONLY = 1;
-
-(my $f = __FILE__) =~ s/p_//;
-do $f; die $@ if $@;
diff --git a/ext/List-Util/t/p_reftype.t b/ext/List-Util/t/p_reftype.t
deleted file mode 100644
index 48e7ef7dcd..0000000000
--- a/ext/List-Util/t/p_reftype.t
+++ /dev/null
@@ -1,7 +0,0 @@
-#!./perl
-
-# force perl-only version to be tested
-$List::Util::TESTING_PERL_ONLY = $List::Util::TESTING_PERL_ONLY = 1;
-
-(my $f = __FILE__) =~ s/p_//;
-do $f; die $@ if $@;
diff --git a/ext/List-Util/t/p_shuffle.t b/ext/List-Util/t/p_shuffle.t
deleted file mode 100644
index 48e7ef7dcd..0000000000
--- a/ext/List-Util/t/p_shuffle.t
+++ /dev/null
@@ -1,7 +0,0 @@
-#!./perl
-
-# force perl-only version to be tested
-$List::Util::TESTING_PERL_ONLY = $List::Util::TESTING_PERL_ONLY = 1;
-
-(my $f = __FILE__) =~ s/p_//;
-do $f; die $@ if $@;
diff --git a/ext/List-Util/t/p_sum.t b/ext/List-Util/t/p_sum.t
deleted file mode 100644
index 48e7ef7dcd..0000000000
--- a/ext/List-Util/t/p_sum.t
+++ /dev/null
@@ -1,7 +0,0 @@
-#!./perl
-
-# force perl-only version to be tested
-$List::Util::TESTING_PERL_ONLY = $List::Util::TESTING_PERL_ONLY = 1;
-
-(my $f = __FILE__) =~ s/p_//;
-do $f; die $@ if $@;
diff --git a/ext/List-Util/t/p_tainted.t b/ext/List-Util/t/p_tainted.t
deleted file mode 100644
index eda5929112..0000000000
--- a/ext/List-Util/t/p_tainted.t
+++ /dev/null
@@ -1,12 +0,0 @@
-#!./perl -T
-
-use File::Spec;
-
-# force perl-only version to be tested
-$List::Util::TESTING_PERL_ONLY = $List::Util::TESTING_PERL_ONLY = 1;
-
-(my $f = __FILE__) =~ s/p_//;
-my $filename = $^O eq 'MSWin32'
- ? File::Spec->rel2abs(File::Spec->catfile(".", $f))
- : File::Spec->catfile(".", $f);
-do $filename; die $@ if $@;
diff --git a/ext/List-Util/t/proto.t b/ext/List-Util/t/proto.t
deleted file mode 100644
index 50e401b59e..0000000000
--- a/ext/List-Util/t/proto.t
+++ /dev/null
@@ -1,59 +0,0 @@
-#!./perl
-
-BEGIN {
- unless (-d 'blib') {
- chdir 't' if -d 't';
- @INC = '../lib';
- require Config; import Config;
- keys %Config; # Silence warning
- if ($Config{extensions} !~ /\bList\/Util\b/) {
- print "1..0 # Skip: List::Util was not built\n";
- exit 0;
- }
- }
-}
-
-use Scalar::Util ();
-use Test::More (grep { /set_prototype/ } @Scalar::Util::EXPORT_FAIL)
- ? (skip_all => 'set_prototype requires XS version')
- : (tests => 13);
-
-Scalar::Util->import('set_prototype');
-
-sub f { }
-is( prototype('f'), undef, 'no prototype');
-
-$r = set_prototype(\&f,'$');
-is( prototype('f'), '$', 'set prototype');
-is( $r, \&f, 'return value');
-
-set_prototype(\&f,undef);
-is( prototype('f'), undef, 'remove prototype');
-
-set_prototype(\&f,'');
-is( prototype('f'), '', 'empty prototype');
-
-sub g (@) { }
-is( prototype('g'), '@', '@ prototype');
-
-set_prototype(\&g,undef);
-is( prototype('g'), undef, 'remove prototype');
-
-sub stub;
-is( prototype('stub'), undef, 'non existing sub');
-
-set_prototype(\&stub,'$$$');
-is( prototype('stub'), '$$$', 'change non existing sub');
-
-sub f_decl ($$$$);
-is( prototype('f_decl'), '$$$$', 'forward declaration');
-
-set_prototype(\&f_decl,'\%');
-is( prototype('f_decl'), '\%', 'change forward declaration');
-
-eval { &set_prototype( 'f', '' ); };
-print "not " unless
-ok($@ =~ /^set_prototype: not a reference/, 'not a reference');
-
-eval { &set_prototype( \'f', '' ); };
-ok($@ =~ /^set_prototype: not a subroutine reference/, 'not a sub reference');
diff --git a/ext/List-Util/t/readonly.t b/ext/List-Util/t/readonly.t
deleted file mode 100644
index 42ed3d811c..0000000000
--- a/ext/List-Util/t/readonly.t
+++ /dev/null
@@ -1,51 +0,0 @@
-#!./perl
-
-BEGIN {
- unless (-d 'blib') {
- chdir 't' if -d 't';
- @INC = '../lib';
- require Config; import Config;
- keys %Config; # Silence warning
- if ($Config{extensions} !~ /\bList\/Util\b/) {
- print "1..0 # Skip: List::Util was not built\n";
- exit 0;
- }
- }
-}
-
-use Scalar::Util qw(readonly);
-use Test::More tests => 11;
-
-ok( readonly(1), 'number constant');
-
-my $var = 2;
-
-ok( !readonly($var), 'number variable');
-is( $var, 2, 'no change to number variable');
-
-ok( readonly("fred"), 'string constant');
-
-$var = "fred";
-
-ok( !readonly($var), 'string variable');
-is( $var, 'fred', 'no change to string variable');
-
-$var = \2;
-
-ok( !readonly($var), 'reference to constant');
-ok( readonly($$var), 'de-reference to constant');
-
-ok( !readonly(*STDOUT), 'glob');
-
-sub try
-{
- my $v = \$_[0];
- return readonly $$v;
-}
-
-$var = 123;
-{
- local $TODO = $Config::Config{useithreads} ? "doesn't work with threads" : undef;
- ok( try ("abc"), 'reference a constant in a sub');
-}
-ok( !try ($var), 'reference a non-constant in a sub');
diff --git a/ext/List-Util/t/reduce.t b/ext/List-Util/t/reduce.t
deleted file mode 100644
index 5d6e3d942c..0000000000
--- a/ext/List-Util/t/reduce.t
+++ /dev/null
@@ -1,152 +0,0 @@
-#!./perl
-
-BEGIN {
- unless (-d 'blib') {
- chdir 't' if -d 't';
- @INC = '../lib';
- require Config; import Config;
- keys %Config; # Silence warning
- if ($Config{extensions} !~ /\bList\/Util\b/) {
- print "1..0 # Skip: List::Util was not built\n";
- exit 0;
- }
- }
-}
-
-
-use List::Util qw(reduce min);
-use Test::More;
-plan tests => ($::PERL_ONLY ? 23 : 25);
-
-my $v = reduce {};
-
-is( $v, undef, 'no args');
-
-$v = reduce { $a / $b } 756,3,7,4;
-is( $v, 9, '4-arg divide');
-
-$v = reduce { $a / $b } 6;
-is( $v, 6, 'one arg');
-
-@a = map { rand } 0 .. 20;
-$v = reduce { $a < $b ? $a : $b } @a;
-is( $v, min(@a), 'min');
-
-@a = map { pack("C", int(rand(256))) } 0 .. 20;
-$v = reduce { $a . $b } @a;
-is( $v, join("",@a), 'concat');
-
-sub add {
- my($aa, $bb) = @_;
- return $aa + $bb;
-}
-
-$v = reduce { my $t="$a $b\n"; 0+add($a, $b) } 3, 2, 1;
-is( $v, 6, 'call sub');
-
-# Check that eval{} inside the block works correctly
-$v = reduce { eval { die }; $a + $b } 0,1,2,3,4;
-is( $v, 10, 'use eval{}');
-
-$v = !defined eval { reduce { die if $b > 2; $a + $b } 0,1,2,3,4 };
-ok($v, 'die');
-
-sub foobar { reduce { (defined(wantarray) && !wantarray) ? $a+1 : 0 } 0,1,2,3 }
-($v) = foobar();
-is( $v, 3, 'scalar context');
-
-sub add2 { $a + $b }
-
-$v = reduce \&add2, 1,2,3;
-is( $v, 6, 'sub reference');
-
-$v = reduce { add2() } 3,4,5;
-is( $v, 12, 'call sub');
-
-
-$v = reduce { eval "$a + $b" } 1,2,3;
-is( $v, 6, 'eval string');
-
-$a = 8; $b = 9;
-$v = reduce { $a * $b } 1,2,3;
-is( $a, 8, 'restore $a');
-is( $b, 9, 'restore $b');
-
-# Can we leave the sub with 'return'?
-$v = reduce {return $a+$b} 2,4,6;
-is($v, 12, 'return');
-
-# ... even in a loop?
-$v = reduce {while(1) {return $a+$b} } 2,4,6;
-is($v, 12, 'return from loop');
-
-# Does it work from another package?
-{ package Foo;
- $a = $b;
- ::is((List::Util::reduce {$a*$b} (1..4)), 24, 'other package');
-}
-
-# Can we undefine a reduce sub while it's running?
-sub self_immolate {undef &self_immolate; 1}
-eval { $v = reduce \&self_immolate, 1,2; };
-like($@, qr/^Can't undef active subroutine/, "undef active sub");
-
-# Redefining an active sub should not fail, but whether the
-# redefinition takes effect immediately depends on whether we're
-# running the Perl or XS implementation.
-
-sub self_updating { local $^W; *self_updating = sub{1} ;1 }
-eval { $v = reduce \&self_updating, 1,2; };
-is($@, '', 'redefine self');
-
-{ my $failed = 0;
-
- sub rec { my $n = shift;
- if (!defined($n)) { # No arg means we're being called by reduce()
- return 1; }
- if ($n<5) { rec($n+1); }
- else { $v = reduce \&rec, 1,2; }
- $failed = 1 if !defined $n;
- }
-
- rec(1);
- ok(!$failed, 'from active sub');
-}
-
-# Calling a sub from reduce should leave its refcount unchanged.
-SKIP: {
- skip("No Internals::SvREFCNT", 1) if !defined &Internals::SvREFCNT;
- sub mult {$a*$b}
- my $refcnt = &Internals::SvREFCNT(\&mult);
- $v = reduce \&mult, 1..6;
- is(&Internals::SvREFCNT(\&mult), $refcnt, "Refcount unchanged");
-}
-
-{
- my $ok = 'failed';
- local $SIG{__DIE__} = sub { $ok = $_[0] =~ /Not a (subroutine|CODE) reference/ ? '' : $_[0] };
- eval { &reduce('foo',1,2) };
- is($ok, '', 'Not a subroutine reference');
- $ok = 'failed';
- eval { &reduce({},1,2) };
- is($ok, '', 'Not a subroutine reference');
-}
-
-# The remainder of the tests are only relevant for the XS
-# implementation. The Perl-only implementation behaves differently
-# (and more flexibly) in a way that we can't emulate from XS.
-if (!$::PERL_ONLY) { SKIP: {
-
- $List::Util::REAL_MULTICALL ||= 0; # Avoid use only once
- skip("Poor man's MULTICALL can't cope", 2)
- if !$List::Util::REAL_MULTICALL;
-
- # Can we goto a label from the reduction sub?
- eval {()=reduce{goto foo} 1,2; foo: 1};
- like($@, qr/^Can't "goto" out of a pseudo block/, "goto label");
-
- # Can we goto a subroutine?
- eval {()=reduce{goto sub{}} 1,2;};
- like($@, qr/^Can't goto subroutine from a sort sub/, "goto sub");
-
-} }
diff --git a/ext/List-Util/t/refaddr.t b/ext/List-Util/t/refaddr.t
deleted file mode 100644
index 35ad40f620..0000000000
--- a/ext/List-Util/t/refaddr.t
+++ /dev/null
@@ -1,111 +0,0 @@
-#!./perl
-
-BEGIN {
- unless (-d 'blib') {
- chdir 't' if -d 't';
- @INC = '../lib';
- require Config; import Config;
- keys %Config; # Silence warning
- if ($Config{extensions} !~ /\bList\/Util\b/) {
- print "1..0 # Skip: List::Util was not built\n";
- exit 0;
- }
- }
-}
-
-
-use Test::More tests => 32;
-
-use Scalar::Util qw(refaddr);
-use vars qw($t $y $x *F $v $r);
-use Symbol qw(gensym);
-
-# Ensure we do not trigger and tied methods
-tie *F, 'MyTie';
-
-my $i = 1;
-foreach $v (undef, 10, 'string') {
- is(refaddr($v), undef, "not " . (defined($v) ? "'$v'" : "undef"));
-}
-
-foreach $r ({}, \$t, [], \*F, sub {}) {
- my $n = "$r";
- $n =~ /0x(\w+)/;
- my $addr = do { local $^W; hex $1 };
- my $before = ref($r);
- is( refaddr($r), $addr, $n);
- is( ref($r), $before, $n);
-
- my $obj = bless $r, 'FooBar';
- is( refaddr($r), $addr, "blessed with overload $n");
- is( ref($r), 'FooBar', $n);
-}
-
-{
- my $z = '77';
- my $y = \$z;
- my $a = '78';
- my $b = \$a;
- tie my %x, 'Hash3', {};
- $x{$y} = 22;
- $x{$b} = 23;
- my $xy = $x{$y};
- my $xb = $x{$b};
- ok(ref($x{$y}));
- ok(ref($x{$b}));
- ok(refaddr($xy) == refaddr($y));
- ok(refaddr($xb) == refaddr($b));
- ok(refaddr($x{$y}));
- ok(refaddr($x{$b}));
-}
-{
- my $z = bless {}, '0';
- ok(refaddr($z));
- @{"0::ISA"} = qw(FooBar);
- my $a = {};
- my $r = refaddr($a);
- $z = bless $a, '0';
- ok(refaddr($z) > 10);
- is(refaddr($z),$r,"foo");
-}
-
-package FooBar;
-
-use overload '0+' => sub { 10 },
- '+' => sub { 10 + $_[1] },
- '"' => sub { "10" };
-
-package MyTie;
-
-sub TIEHANDLE { bless {} }
-sub DESTROY {}
-
-sub AUTOLOAD {
- warn "$AUTOLOAD called";
- exit 1; # May be in an eval
-}
-
-package Hash3;
-
-use Scalar::Util qw(refaddr);
-
-sub TIEHASH
-{
- my $pkg = shift;
- return bless [ @_ ], $pkg;
-}
-sub FETCH
-{
- my $self = shift;
- my $key = shift;
- my ($underlying) = @$self;
- return $underlying->{refaddr($key)};
-}
-sub STORE
-{
- my $self = shift;
- my $key = shift;
- my $value = shift;
- my ($underlying) = @$self;
- return ($underlying->{refaddr($key)} = $key);
-}
diff --git a/ext/List-Util/t/reftype.t b/ext/List-Util/t/reftype.t
deleted file mode 100644
index a7adafb996..0000000000
--- a/ext/List-Util/t/reftype.t
+++ /dev/null
@@ -1,61 +0,0 @@
-#!./perl
-
-BEGIN {
- unless (-d 'blib') {
- chdir 't' if -d 't';
- @INC = '../lib';
- require Config; import Config;
- keys %Config; # Silence warning
- if ($Config{extensions} !~ /\bList\/Util\b/) {
- print "1..0 # Skip: List::Util was not built\n";
- exit 0;
- }
- }
-}
-
-use Test::More tests => 29;
-
-use Scalar::Util qw(reftype);
-use vars qw($t $y $x *F);
-use Symbol qw(gensym);
-
-# Ensure we do not trigger and tied methods
-tie *F, 'MyTie';
-my $RE = $] < 5.011 ? 'SCALAR' : 'REGEXP';
-
-@test = (
- [ undef, 1, 'number' ],
- [ undef, 'A', 'string' ],
- [ HASH => {}, 'HASH ref' ],
- [ ARRAY => [], 'ARRAY ref' ],
- [ SCALAR => \$t, 'SCALAR ref' ],
- [ REF => \(\$t), 'REF ref' ],
- [ GLOB => \*F, 'tied GLOB ref' ],
- [ GLOB => gensym, 'GLOB ref' ],
- [ CODE => sub {}, 'CODE ref' ],
- [ IO => *STDIN{IO},'IO ref' ],
- [ $RE => qr/x/, 'REGEEXP' ],
-);
-
-foreach $test (@test) {
- my($type,$what, $n) = @$test;
-
- is( reftype($what), $type, $n);
- next unless ref($what);
-
- bless $what, "ABC";
- is( reftype($what), $type, $n);
-
- bless $what, "0";
- is( reftype($what), $type, $n);
-}
-
-package MyTie;
-
-sub TIEHANDLE { bless {} }
-sub DESTROY {}
-
-sub AUTOLOAD {
- warn "$AUTOLOAD called";
- exit 1; # May be in an eval
-}
diff --git a/ext/List-Util/t/shuffle.t b/ext/List-Util/t/shuffle.t
deleted file mode 100644
index d3fbd6cd1f..0000000000
--- a/ext/List-Util/t/shuffle.t
+++ /dev/null
@@ -1,36 +0,0 @@
-#!./perl
-
-BEGIN {
- unless (-d 'blib') {
- chdir 't' if -d 't';
- @INC = '../lib';
- require Config; import Config;
- keys %Config; # Silence warning
- if ($Config{extensions} !~ /\bList\/Util\b/) {
- print "1..0 # Skip: List::Util was not built\n";
- exit 0;
- }
- }
-}
-
-use Test::More tests => 6;
-
-use List::Util qw(shuffle);
-
-my @r;
-
-@r = shuffle();
-ok( !@r, 'no args');
-
-@r = shuffle(9);
-is( 0+@r, 1, '1 in 1 out');
-is( $r[0], 9, 'one arg');
-
-my @in = 1..100;
-@r = shuffle(@in);
-is( 0+@r, 0+@in, 'arg count');
-
-isnt( "@r", "@in", 'result different to args');
-
-my @s = sort { $a <=> $b } @r;
-is( "@in", "@s", 'values');
diff --git a/ext/List-Util/t/stack-corruption.t b/ext/List-Util/t/stack-corruption.t
deleted file mode 100644
index dff5af03c4..0000000000
--- a/ext/List-Util/t/stack-corruption.t
+++ /dev/null
@@ -1,30 +0,0 @@
-#!./perl
-
-BEGIN {
- unless (-d 'blib') {
- chdir 't' if -d 't';
- @INC = '../lib';
- require Config; import Config;
- keys %Config; # Silence warning
- if ($Config{extensions} !~ /\bList\/Util\b/) {
- print "1..0 # Skip: List::Util was not built\n";
- exit 0;
- }
- }
- if ($] eq "5.008009" or $] eq "5.010000" or $] le "5.006002") {
- print "1..0 # Skip: known to fail on $]\n";
- exit 0;
- }
-}
-
-use List::Util qw(reduce);
-use Test::More tests => 1;
-
-my $ret = "original";
-$ret = $ret . broken();
-is($ret, "originalreturn");
-
-sub broken {
- reduce { return "bogus"; } qw/some thing/;
- return "return";
-}
diff --git a/ext/List-Util/t/sum.t b/ext/List-Util/t/sum.t
deleted file mode 100644
index ef484f96c5..0000000000
--- a/ext/List-Util/t/sum.t
+++ /dev/null
@@ -1,69 +0,0 @@
-#!./perl
-
-BEGIN {
- unless (-d 'blib') {
- chdir 't' if -d 't';
- @INC = '../lib';
- require Config; import Config;
- keys %Config; # Silence warning
- if ($Config{extensions} !~ /\bList\/Util\b/) {
- print "1..0 # Skip: List::Util was not built\n";
- exit 0;
- }
- }
-}
-
-use Test::More tests => 8;
-
-use List::Util qw(sum);
-
-my $v = sum;
-is( $v, undef, 'no args');
-
-$v = sum(9);
-is( $v, 9, 'one arg');
-
-$v = sum(1,2,3,4);
-is( $v, 10, '4 args');
-
-$v = sum(-1);
-is( $v, -1, 'one -1');
-
-my $x = -3;
-
-$v = sum($x, 3);
-is( $v, 0, 'variable arg');
-
-$v = sum(-3.5,3);
-is( $v, -0.5, 'real numbers');
-
-my $one = Foo->new(1);
-my $two = Foo->new(2);
-my $thr = Foo->new(3);
-
-$v = sum($one,$two,$thr);
-is($v, 6, 'overload');
-
-
-{ package Foo;
-
-use overload
- '""' => sub { ${$_[0]} },
- '+0' => sub { ${$_[0]} },
- fallback => 1;
- sub new {
- my $class = shift;
- my $value = shift;
- bless \$value, $class;
- }
-}
-
-SKIP: {
- eval { require bignum; } or skip("Need bignum for testing overloading",1);
-
- my $v1 = 2**65;
- my $v2 = 2**65;
- my $v3 = $v1 + $v2;
- $v = sum($v1,$v2);
- is($v, $v3, 'bignum');
-}
diff --git a/ext/List-Util/t/tainted.t b/ext/List-Util/t/tainted.t
deleted file mode 100644
index 09ad330684..0000000000
--- a/ext/List-Util/t/tainted.t
+++ /dev/null
@@ -1,34 +0,0 @@
-#!./perl -T
-
-BEGIN {
- unless (-d 'blib') {
- chdir 't' if -d 't';
- @INC = '../lib';
- require Config; import Config;
- keys %Config; # Silence warning
- if ($Config{extensions} !~ /\bList\/Util\b/) {
- print "1..0 # Skip: List::Util was not built\n";
- exit 0;
- }
- }
- elsif(!grep {/blib/} @INC) {
- unshift(@INC, qw(./inc ./blib/arch ./blib/lib));
- }
-}
-
-use Test::More tests => 4;
-
-use Scalar::Util qw(tainted);
-
-ok( !tainted(1), 'constant number');
-
-my $var = 2;
-
-ok( !tainted($var), 'known variable');
-
-my $key = (keys %ENV)[0];
-
-ok( tainted($ENV{$key}), 'environment variable');
-
-$var = $ENV{$key};
-ok( tainted($var), 'copy of environment variable');
diff --git a/ext/List-Util/t/weak.t b/ext/List-Util/t/weak.t
deleted file mode 100644
index f014113694..0000000000
--- a/ext/List-Util/t/weak.t
+++ /dev/null
@@ -1,208 +0,0 @@
-#!./perl
-
-use strict;
-use Config;
-BEGIN {
- unless (-d 'blib') {
- chdir 't' if -d 't';
- @INC = '../lib';
- keys %Config; # Silence warning
- if ($Config{extensions} !~ /\bList\/Util\b/) {
- print "1..0 # Skip: List::Util was not built\n";
- exit 0;
- }
- }
-}
-
-use Scalar::Util ();
-use Test::More ((grep { /weaken/ } @Scalar::Util::EXPORT_FAIL) and !$ENV{PERL_CORE})
- ? (skip_all => 'weaken requires XS version')
- : (tests => 22);
-
-if (0) {
- require Devel::Peek;
- Devel::Peek->import('Dump');
-}
-else {
- *Dump = sub {};
-}
-
-Scalar::Util->import(qw(weaken isweak));
-
-if(1) {
-
-my ($y,$z);
-
-#
-# Case 1: two references, one is weakened, the other is then undef'ed.
-#
-
-{
- my $x = "foo";
- $y = \$x;
- $z = \$x;
-}
-print "# START\n";
-Dump($y); Dump($z);
-
-ok( ref($y) and ref($z));
-
-print "# WEAK:\n";
-weaken($y);
-Dump($y); Dump($z);
-
-ok( ref($y) and ref($z));
-
-print "# UNDZ:\n";
-undef($z);
-Dump($y); Dump($z);
-
-ok( not (defined($y) and defined($z)) );
-
-print "# UNDY:\n";
-undef($y);
-Dump($y); Dump($z);
-
-ok( not (defined($y) and defined($z)) );
-
-print "# FIN:\n";
-Dump($y); Dump($z);
-
-
-#
-# Case 2: one reference, which is weakened
-#
-
-print "# CASE 2:\n";
-
-{
- my $x = "foo";
- $y = \$x;
-}
-
-ok( ref($y) );
-print "# BW: \n";
-Dump($y);
-weaken($y);
-print "# AW: \n";
-Dump($y);
-ok( not defined $y );
-
-print "# EXITBLOCK\n";
-}
-
-#
-# Case 3: a circular structure
-#
-
-my $flag = 0;
-{
- my $y = bless {}, 'Dest';
- Dump($y);
- print "# 1: $y\n";
- $y->{Self} = $y;
- Dump($y);
- print "# 2: $y\n";
- $y->{Flag} = \$flag;
- print "# 3: $y\n";
- weaken($y->{Self});
- print "# WKED\n";
- ok( ref($y) );
- print "# VALS: HASH ",$y," SELF ",\$y->{Self}," Y ",\$y,
- " FLAG: ",\$y->{Flag},"\n";
- print "# VPRINT\n";
-}
-print "# OUT $flag\n";
-ok( $flag == 1 );
-
-print "# AFTER\n";
-
-undef $flag;
-
-print "# FLAGU\n";
-
-#
-# Case 4: a more complicated circular structure
-#
-
-$flag = 0;
-{
- my $y = bless {}, 'Dest';
- my $x = bless {}, 'Dest';
- $x->{Ref} = $y;
- $y->{Ref} = $x;
- $x->{Flag} = \$flag;
- $y->{Flag} = \$flag;
- weaken($x->{Ref});
-}
-ok( $flag == 2 );
-
-#
-# Case 5: deleting a weakref before the other one
-#
-
-my ($y,$z);
-{
- my $x = "foo";
- $y = \$x;
- $z = \$x;
-}
-
-print "# CASE5\n";
-Dump($y);
-
-weaken($y);
-Dump($y);
-undef($y);
-
-ok( not defined $y);
-ok( ref($z) );
-
-
-#
-# Case 6: test isweakref
-#
-
-$a = 5;
-ok(!isweak($a));
-$b = \$a;
-ok(!isweak($b));
-weaken($b);
-ok(isweak($b));
-$b = \$a;
-ok(!isweak($b));
-
-my $x = {};
-weaken($x->{Y} = \$a);
-ok(isweak($x->{Y}));
-ok(!isweak($x->{Z}));
-
-#
-# Case 7: test weaken on a read only ref
-#
-
-SKIP: {
- # Doesn't work for older perls, see bug [perl #24506]
- skip("Test does not work with perl < 5.8.3", 5) if $] < 5.008003;
-
- # in a MAD build, constants have refcnt 2, not 1
- skip("Test does not work with MAD", 5) if exists $Config{mad};
-
- $a = eval '\"hello"';
- ok(ref($a)) or print "# didn't get a ref from eval\n";
- $b = $a;
- eval{weaken($b)};
- # we didn't die
- ok($@ eq "") or print "# died with $@\n";
- ok(isweak($b));
- ok($$b eq "hello") or print "# b is '$$b'\n";
- $a="";
- ok(not $b) or print "# b didn't go away\n";
-}
-
-package Dest;
-
-sub DESTROY {
- print "# INCFLAG\n";
- ${$_[0]{Flag}} ++;
-}