i.e. it compiles and passes tests.
* 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.
#!/usr/bin/perl -w
-use 5.008;
+use 5.006;
use ExtUtils::MakeMaker;
use strict;
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') : ()),
);
use strict;
use vars qw($VERSION @ISA @EXPORT_OK %EXPORT_TAGS $warn $dangle);
-require 5.008;
+require 5.006;
require Exporter;
require XSLoader;
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
{
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');
}
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');
}