+++ /dev/null
-#!/usr/bin/perl -w
-
-# Dear Distribution Packager. This use of require is intentional.
-# Module::Install detects Build.PL usage and acts accordingly.
-require 'Makefile.PL';
Revision history for Perl extension Devel::Size.
+0.67 2007-03-15 Tels 20 tests
+ * rip out Build.PL since it doesn't actually work
+ * fix bug #1653: All SVPV subtype may contain an RV instead of a PV
+ (Thanx a lot Jan, and sorry for the truly horrible long delay!)
+ * fix bug #24846: Does not correctly recurse into references in PVNV
+ (Thanx STEVIEO)
+ * add t/recurse.t that tests the two bugfixes in combination
+
+0.66 2007-03-02 Tels 15 tests
+ * fix the failing test (the code was right, but the test wrong)
+
0.65 2007-02-24 Tels 15 tests
* fix the test failings under 64 bit (bugs #21037, #18596, #21404)
* fix wrong size for strings (bug #17586)
-Build.PL
CHANGES
inc/Module/Install.pm
inc/Module/Install/Base.pm
-inc/Module/Install/Build.pm
inc/Module/Install/Can.pm
inc/Module/Install/Fetch.pm
inc/Module/Install/Makefile.pm
t/basic.t
t/pod.t
t/pod_cov.t
+t/recurse.t
+---
abstract: Perl extension for finding the memory usage of Perl variables
author: Tels <nospam-abuse@bloodgate.com>
build_requires:
Test::More: 0.42
distribution_type: module
-generated_by: Module::Install version 0.64
+generated_by: Module::Install version 0.65
license: perl
+meta-spec:
+ url: http://module-build.sourceforge.net/META-spec-v1.3.html
+ version: 1.3
name: Devel-Size
no_index:
directory:
Devel::Size::Report: 0.11
requires:
DynaLoader: 0
-version: 0.66
+version: 0.67
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
-SHA1 38dd40d4fe9a8a408648f2f2c1a2a3ac76bbac72 Build.PL
-SHA1 4a8ab802f0246e9161adf3226bcea18eb3e2e1f1 CHANGES
-SHA1 34c2335f7a87ba91a983fe877e916ea4481dd10e MANIFEST
+SHA1 8209b79fe86e5a4a8698b8a3f13c6f05467bfbc8 CHANGES
+SHA1 b41fb799702683e35ca968f55018175c8c6298e9 MANIFEST
SHA1 134aae6f44102ce9b0f7fa7a3710e41a0cd23646 MANIFEST.SKIP
-SHA1 f3d8cf6515bd782e6ea7717f5ad1dd15d9117ecd META.yml
+SHA1 08fcfb52a30000bd80a37f0ee91d917706690884 META.yml
SHA1 6ed187e4890948dacf792b44ab18fa143a580ace Makefile.PL
-SHA1 498997a1a0785e1088db3fc85a47583cd1ad02cf Size.xs
-SHA1 9b2f9d83bcf77860f53a0c07c90a4a59ad9f5df1 inc/Module/Install.pm
-SHA1 abe32855d75ab13747cf65765af9947b7a8c3057 inc/Module/Install/Base.pm
-SHA1 da9dfbb8ae4a8a8bac0ab9cd7ef7dc89e4cb5dbe inc/Module/Install/Build.pm
-SHA1 95b81d1e91bd634467bf633571eff4420e9c04eb inc/Module/Install/Can.pm
-SHA1 1fe98c63cf9d7271c8cb4183ba230f152df69e26 inc/Module/Install/Fetch.pm
-SHA1 2249171a2b72cd73ff2c0a06597d29f86e5df456 inc/Module/Install/Makefile.pm
-SHA1 381bb98ea3877bba49ae85e7a7ea130645fd3dbf inc/Module/Install/Metadata.pm
-SHA1 0c2118868ef82ac517eb6d9c3bd93e6eb9bbf83e inc/Module/Install/Win32.pm
-SHA1 e827d6d43771032fa3df35c0ad5e5698d0e54cda inc/Module/Install/WriteAll.pm
-SHA1 0eb820ab28ffddd7b040083154129d99885e6093 lib/Devel/Size.pm
-SHA1 78ea8a9d47029fbe04d3cf6c0bbcc80c493d8d35 t/basic.t
+SHA1 3ddc18f9e90d5837031fcad6c6b62076512cc75a Size.xs
+SHA1 ceac99579ef3914de1936417282842c07d907a6a inc/Module/Install.pm
+SHA1 6c9471c92c28e247fb84f4ab7dc277f68b33ea95 inc/Module/Install/Base.pm
+SHA1 b2cb1026330e8c4f8533c79569498ab15f189d86 inc/Module/Install/Can.pm
+SHA1 78acbad45c4289c228ead2278fc213ddd66bcead inc/Module/Install/Fetch.pm
+SHA1 642e5b27f4cbbbe440e5dc05c639f5fb79875fe3 inc/Module/Install/Makefile.pm
+SHA1 80d024f3eccf1c825b02b5e59de236b0af7d4bfc inc/Module/Install/Metadata.pm
+SHA1 fe6780ea5cfd67c79140699fbd4f0fe262255d57 inc/Module/Install/Win32.pm
+SHA1 51d43bffcfd7ffdecb8c8e9f97f3896c31b2e1b2 inc/Module/Install/WriteAll.pm
+SHA1 11650747f74e8a932e7c35a626cf36754104264e lib/Devel/Size.pm
+SHA1 3b24073cb8b1a95aa924327aaa4463c24cbf3c47 t/basic.t
SHA1 dc638392e64661dd07deeba11f67e35650a6384a t/pod.t
SHA1 cab9b9f7a912f8a18e5301841da22dead08d00f3 t/pod_cov.t
+SHA1 5bb930d42d5b99e7ca23283ad848dcdc6b9565bc t/recurse.t
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
-iQEVAwUBRehf63cLPEOTuEwVAQKH1Qf/TlFBa1qOaOais2sHR26hKeipcjoI3pE3
-8ndnBEG28naSwZbrIWLhmACoq+rVVWEQo+kxhTWuD2xOG4vSC818e8FeHilx9FIb
-IO7yriUREphtgh/mTzBYthGJqvSBa5e2EDgaXmU98VI9IFTEyubHkJPipCKhPH+a
-hvCKHobigcMP9NtU7E8UGuzHqKvYgEiTyZUJYx2Hv2g/DjwiDo8JnFHsy7U8rXBf
-j5qKl7YnhGZpBx//emR1sVFlSAh+5lI8pzJzU1DqnZ2+JTfvXlVCdCtkEzhVWW93
-CaPNhYfmfovANcL3pWiBAS31lEKHZ+RPK5aakQ/H08QmYPmVm1BQ+Q==
-=GuOo
+iQEVAwUBRfmXY3cLPEOTuEwVAQJ9xAf6A1uUjeE5EPb3/7+DRpMfh5drJTwm8sFd
+iJr7wPHejdY5UoF6lckTCa4gA4OPuiGfTdNf1Mmy2HEFzDbxMaK1m5nCiYb9fAWG
+E7p5bFZizawI7QNHRULpWXOWAL+HH4yUL/F2LqENOVmy/PCwfjpm4VlTysvj+a1L
+AlABEuHk3T2sRkUwCrx9/ADJ0o/ZiFki7Gxky0aLI1zffMKl5+k6psZ+zuIiuzre
+gB4r6obpKIggrkVbLcftmdZQVUD/2YjH+38hziL2uAxY/iDQ6HsBRD4Ef480c5xW
+Bp6Nko65UME/OiSOEE7hbJFDGf/EKv5OXB/UXEsdBJdO9Xyk6OivxQ==
+=eNsE
-----END PGP SIGNATURE-----
UV thing_size(SV *orig_thing, HV *tracking_hash) {
SV *thing = orig_thing;
UV total_size = sizeof(SV);
-
+
switch (SvTYPE(thing)) {
/* Is it undef? */
case SVt_NULL:
much has been allocated */
case SVt_PV:
total_size += sizeof(XPV);
- total_size += SvLEN(thing);
+ total_size += SvROK(thing) ? thing_size( SvRV(thing), tracking_hash) : SvLEN(thing);
break;
/* A string with an integer part? */
case SVt_PVIV:
total_size += sizeof(XPVIV);
- total_size += SvLEN(thing);
+ total_size += SvROK(thing) ? thing_size( SvRV(thing), tracking_hash) : SvLEN(thing);
if(SvOOK(thing)) {
total_size += SvIVX(thing);
}
/* A string with a float part? */
case SVt_PVNV:
total_size += sizeof(XPVNV);
- total_size += SvLEN(thing);
+ total_size += SvROK(thing) ? thing_size( SvRV(thing), tracking_hash) : SvLEN(thing);
break;
case SVt_PVMG:
total_size += sizeof(XPVMG);
- total_size += SvLEN(thing);
+ total_size += SvROK(thing) ? thing_size( SvRV(thing), tracking_hash) : SvLEN(thing);
total_size += magic_size(thing, tracking_hash);
break;
#if PERL_VERSION <= 8
case SVt_PVBM:
total_size += sizeof(XPVBM);
- total_size += SvLEN(thing);
+ total_size += SvROK(thing) ? thing_size( SvRV(thing), tracking_hash) : SvLEN(thing);
total_size += magic_size(thing, tracking_hash);
break;
#endif
case SVt_PVLV:
total_size += sizeof(XPVLV);
- total_size += SvLEN(thing);
+ total_size += SvROK(thing) ? thing_size( SvRV(thing), tracking_hash) : SvLEN(thing);
total_size += magic_size(thing, tracking_hash);
break;
/* How much space is dedicated to the array? Not counting the
total_size, sizeof(SV*), AvARRAY(thing), AvALLOC(thing), sizeof( thing )); */
/* under Perl 5.8.8 64bit threading, AvARRAY(thing) was a pointer while AvALLOC was 0,
- resulting in grossly overstated sized for arrays */
+ resulting in grossly overstated sized for arrays. Technically, this shouldn't happen... */
if (AvALLOC(thing) != 0) {
total_size += (sizeof(SV *) * (AvARRAY(thing) - AvALLOC(thing)));
}
av_push(pending_array, SvRV(thing));
break;
+ /* fix for bug #24846 (Does not correctly recurse into references in a PVNV-type scalar) */
+ case SVt_PVNV:
+ if (SvROK(thing))
+ {
+ av_push(pending_array, SvRV(thing));
+ }
+ break;
+
case SVt_PVAV:
{
/* Quick alias to cut down on casting */
# This is not enforced yet, but will be some time in the next few
# releases once we can make sure it won't clash with custom
# Module::Install extensions.
- $VERSION = '0.64';
+ $VERSION = '0.65';
}
# Whether or not inc::Module::Install is actually loaded, the
#line 1
package Module::Install::Base;
-$VERSION = '0.64';
+$VERSION = '0.65';
# Suspend handler for "redefined" warnings
BEGIN {
+++ /dev/null
-#line 1
-package Module::Install::Build;
-
-use strict;
-use Module::Install::Base;
-
-use vars qw{$VERSION $ISCORE @ISA};
-BEGIN {
- $VERSION = '0.64';
- $ISCORE = 1;
- @ISA = qw{Module::Install::Base};
-}
-
-sub Build { $_[0] }
-
-sub write {
- my $self = shift;
- die "Build->write() takes no arguments\n" if @_;
-
- my %args;
- my $build;
-
- $args{dist_name} = $self->name || $self->determine_NAME($self->{args});
- $args{license} = $self->license;
- $args{test_files} = $self->tests;
- $args{dist_version} = $self->version || $self->determine_VERSION($self->{args});
- $args{dist_abstract} = $self->abstract;
- $args{dist_author} = $self->author;
- $args{sign} = $self->sign;
- $args{no_index} = $self->no_index;
-
- foreach my $key (qw(build_requires requires recommends conflicts)) {
- my $val = eval "\$self->$key" or next;
- $args{$key} = { map @$_, @$val };
- }
-
- %args = map {($_, $args{$_})} grep {defined($args{$_})} keys %args;
-
- require Module::Build;
- $build = Module::Build->new(%args);
- $build->add_to_cleanup(split /\s+/, $self->clean_files);
- $build->create_build_script;
-}
-
-sub ACTION_reset {
- my ($self) = @_;
- die "XXX - Can't get this working yet";
- require File::Path;
- warn "Removing inc\n";
- rmpath('inc');
-}
-
-sub ACTION_dist {
- my ($self) = @_;
- die "XXX - Can't get this working yet";
-}
-
-# <ingy> DrMath: is there an OO way to add actions to Module::Build??
-# <DrMath> ingy: yeah
-# <DrMath> ingy: package MyBuilder; use w(Module::Build; @ISA = qw(w(Module::Build); sub ACTION_ingy
-# {...}
-# <DrMath> ingy: then my $build = new MyBuilder( ...parameters... );
-# $build->write_build_script;
-
-1;
-
-__END__
-
-#line 180
use vars qw{$VERSION $ISCORE @ISA};
BEGIN {
- $VERSION = '0.64';
+ $VERSION = '0.65';
$ISCORE = 1;
@ISA = qw{Module::Install::Base};
}
use vars qw{$VERSION $ISCORE @ISA};
BEGIN {
- $VERSION = '0.64';
+ $VERSION = '0.65';
$ISCORE = 1;
@ISA = qw{Module::Install::Base};
}
use vars qw{$VERSION $ISCORE @ISA};
BEGIN {
- $VERSION = '0.64';
+ $VERSION = '0.65';
$ISCORE = 1;
@ISA = qw{Module::Install::Base};
}
. "but we need version >= $perl_version";
}
+ $args->{INSTALLDIRS} = $self->installdirs;
+
my %args = map { ( $_ => $args->{$_} ) } grep {defined($args->{$_})} keys %$args;
- if ($self->admin->preop) {
- $args{dist} = $self->admin->preop;
+
+ my $user_preop = delete $args{dist}->{PREOP};
+ if (my $preop = $self->admin->preop($user_preop)) {
+ $args{dist} = $preop;
}
my $mm = ExtUtils::MakeMaker::WriteMakefile(%args);
__END__
-#line 334
+#line 338
use vars qw{$VERSION $ISCORE @ISA};
BEGIN {
- $VERSION = '0.64';
+ $VERSION = '0.65';
$ISCORE = 1;
@ISA = qw{Module::Install::Base};
}
my @scalar_keys = qw{
name module_name abstract author version license
- distribution_type perl_version tests
+ distribution_type perl_version tests installdirs
};
my @tuple_keys = qw{
};
}
+sub install_as_core { $_[0]->installdirs('perl') }
+sub install_as_cpan { $_[0]->installdirs('site') }
+sub install_as_site { $_[0]->installdirs('site') }
+sub install_as_vendor { $_[0]->installdirs('vendor') }
+
sub sign {
my $self = shift;
return $self->{'values'}{'sign'} if defined wantarray and !@_;
if (
$self->_slurp($file) =~ m/
- =head \d \s+
- (?:licen[cs]e|licensing|copyright|legal)\b
- (.*?)
+ (
+ =head \d \s+
+ (?:licen[cs]e|licensing|copyright|legal)\b
+ .*?
+ )
(=head\\d.*|=cut.*|)
\z
/ixms
'LGPL' => 'lgpl',
'BSD' => 'bsd',
'Artistic' => 'artistic',
+ 'MIT' => 'MIT',
);
while ( my ( $pattern, $license ) = splice( @phrases, 0, 2 ) ) {
$pattern =~ s{\s+}{\\s+}g;
use vars qw{$VERSION $ISCORE @ISA};
BEGIN {
- $VERSION = '0.64';
+ $VERSION = '0.65';
$ISCORE = 1;
@ISA = qw{Module::Install::Base};
}
use vars qw{$VERSION $ISCORE @ISA};
BEGIN {
- $VERSION = '0.64';
+ $VERSION = '0.65';
$ISCORE = 1;
@ISA = qw{Module::Install::Base};
}
@EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
@EXPORT = qw( );
-$VERSION = '0.66';
+$VERSION = '0.67';
bootstrap Devel::Size $VERSION;
=head1 COPYRIGHT
-Copyright (C) 2005 Dan Sugalski.
-Copyright (C) 2007 Tels
+Copyright (C) 2005 Dan Sugalski, Copyright (C) 2007 Tels
This module is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
Devel::Size->import( qw(size total_size) );
die ("Uhoh, test uses outdated version of Devel::Size")
- unless is ($Devel::Size::VERSION, '0.66', 'VERSION MATCHES');
+ unless is ($Devel::Size::VERSION, '0.67', 'VERSION MATCHES');
#############################################################################
# some basic checks:
--- /dev/null
+#!/usr/bin/perl -w
+
+use Test::More;
+use strict;
+
+my $tests;
+
+BEGIN
+ {
+ chdir 't' if -d 't';
+ plan tests => 5;
+
+ use lib '../lib';
+ use lib '../blib/arch';
+ use_ok('Devel::Size');
+ }
+
+can_ok ('Devel::Size', qw/
+ size
+ total_size
+ /);
+
+Devel::Size->import( qw(size total_size) );
+
+die ("Uhoh, test uses outdated version of Devel::Size")
+ unless is ($Devel::Size::VERSION, '0.67', 'VERSION MATCHES');
+
+#############################################################################
+# #24846 (Does not correctly recurse into references in a PVNV-type scalar)
+
+my $size = 100;
+my $hash = {};
+
+my $empty_hash = total_size($hash);
+
+$hash->{a} = 0/1;
+$hash->{a} = [];
+
+my $hash_size = total_size($hash);
+my $element_size = total_size($hash->{a});
+
+ok ($element_size < $hash_size, "element < hash with one element");
+
+my $array_size = total_size([0..$size]) - total_size( [] );
+
+$hash->{a} = [0..$size];
+my $full_hash = total_size($hash);
+
+#print "$full_hash\n";
+#print "$array_size\n";
+#print "$hash_size\n";
+#print "$element_size\n";
+
+# the total size is:
+
+# the contents of the array (array size)
+# the hash
+# the PVNV in the hash
+# the RV inside the PVNV
+
+is ($full_hash, $array_size + $hash_size, 'properly recurses into PVNV');
+