From: Nicholas Clark Date: Sun, 8 May 2011 08:16:57 +0000 (+0200) Subject: Reinstate 5.6.x "support". X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=d6158a765909946609d49f5e09122a73ec923def;p=p5sagit%2FDevel-Size.git Reinstate 5.6.x "support". i.e. it compiles and passes tests. --- diff --git a/CHANGES b/CHANGES index e91a6b9..6b47112 100644 --- a/CHANGES +++ b/CHANGES @@ -5,6 +5,7 @@ Revision history for Perl extension Devel::Size. * Correctly handle SvOOK scalars. 5.12 and later don't use SvIVX(). * Magic vtables aren't freed when magic is freed, so don't count them. (They are static structures. Anything that assumes otherwise is buggy.) + * Reinstate 5.6.x "support". (i.e. it compiles and passes tests.) 0.75_51 2011-05-05 nicholas * Only use a static array of vtables on gcc. diff --git a/Makefile.PL b/Makefile.PL index e2dce20..497c2db 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -1,5 +1,5 @@ #!/usr/bin/perl -w -use 5.008; +use 5.006; use ExtUtils::MakeMaker; use strict; @@ -12,6 +12,7 @@ WriteMakefile( NAME => 'Devel::Size', VERSION_FROM => 'lib/Devel/Size.pm', DEFINE => "-DALIGN_BITS=$ptr_bits", - (eval $ExtUtils::MakeMaker::VERSION >= 6.47 ? (MIN_PERL_VERSION => '5.008') : ()), + PREREQ_PM => { 'Test::More' => 0 }, + (eval $ExtUtils::MakeMaker::VERSION >= 6.47 ? (MIN_PERL_VERSION => '5.006') : ()), (eval $ExtUtils::MakeMaker::VERSION >= 6.31 ? (LICENSE => 'perl') : ()), ); diff --git a/lib/Devel/Size.pm b/lib/Devel/Size.pm index 51e61ec..842f866 100644 --- a/lib/Devel/Size.pm +++ b/lib/Devel/Size.pm @@ -3,7 +3,7 @@ package Devel::Size; use strict; use vars qw($VERSION @ISA @EXPORT_OK %EXPORT_TAGS $warn $dangle); -require 5.008; +require 5.006; require Exporter; require XSLoader; diff --git a/t/basic.t b/t/basic.t index 4166e2d..127cb39 100644 --- a/t/basic.t +++ b/t/basic.t @@ -3,7 +3,6 @@ use Test::More tests => 19; use strict; use Devel::Size qw(size total_size); -use Scalar::Util qw(weaken); can_ok ('Devel::Size', qw/ size @@ -84,8 +83,18 @@ cmp_ok (total_size(\&LARGE), '>', 8192, { my $a = []; my $b = \$a; - # making a weakref upgrades the target to PVMG and adds magic - weaken $b; + # Scalar::Util isn't in the core before 5.7.something. + # The test isn't really testing anything without the weaken(), but it + # isn't counter-productive or harmful to run it anyway. + unless (eval { + require Scalar::Util; + # making a weakref upgrades the target to PVMG and adds magic + Scalar::Util::weaken($b); + 1; + }) { + die $@ if $] >= 5.008; + } + is(total_size($a), total_size([]), 'Any intial reference is dereferenced and discarded'); } diff --git a/t/globs.t b/t/globs.t index d37826a..247bb84 100644 --- a/t/globs.t +++ b/t/globs.t @@ -135,7 +135,8 @@ sub gv_grew { gv_grew('glipp', 'zok', 'no strict "vars"; $zok = undef; 1', 'SCALAR'); gv_grew('bang', 'boff', 'no strict "vars"; @boff = (); 1', 'ARRAY'); gv_grew('clange', 'sock', 'no strict "vars"; %sock = (); 1', 'HASH'); -{ +SKIP: { + skip("Can't create FORMAT references prior to 5.8.0", 7) if $] < 5.008; local $Devel::Size::warn = 0; gv_grew('biff', 'zapeth', "format zapeth =\n.\n1", 'FORMAT'); }