From: Tels Date: Sun, 12 Aug 2007 14:05:37 +0000 (-0800) Subject: import Devel-Size 0.69 from CPAN X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=5a83b7cfbe04badf89f4f814c5657e3531538978;p=p5sagit%2FDevel-Size.git import Devel-Size 0.69 from CPAN git-cpan-module: Devel-Size git-cpan-version: 0.69 git-cpan-authorid: TELS git-cpan-file: authors/id/T/TE/TELS/devel/Devel-Size-0.69.tar.gz --- diff --git a/CHANGES b/CHANGES index df20f1c..e8aaa3b 100644 --- a/CHANGES +++ b/CHANGES @@ -1,5 +1,10 @@ Revision history for Perl extension Devel::Size. +0.69 2007-08-11 Tels 69 tests + * fix compilation under Perl v5.9.5 and v5.10 (Thanx Steve Peters!) + * clarify the license by specifying Perl v5.8.8's license + * smal doc fixes, add a README file + 0.68 2007-06-12 Tels 69 tests * remove a bit of duplicate code in op_size, the second instance was a no-op anyway diff --git a/MANIFEST b/MANIFEST index b14984c..264df3d 100644 --- a/MANIFEST +++ b/MANIFEST @@ -12,6 +12,7 @@ Makefile.PL MANIFEST MANIFEST.SKIP META.yml Module meta-data (added by MakeMaker) +README SIGNATURE Size.xs t/basic.t diff --git a/MANIFEST.SKIP b/MANIFEST.SKIP index 8b9d4e4..81301f0 100644 --- a/MANIFEST.SKIP +++ b/MANIFEST.SKIP @@ -2,6 +2,7 @@ # prevent this file to be added to the MANIFEST during a # # make manifest +# # command. # ^Devel-Size.*\.tar\.gz @@ -11,3 +12,5 @@ ^MANIFEST.(bak|old) ^Size.(c|o|bs) ^blib.* +tmon.out +\.txt\z diff --git a/META.yml b/META.yml index 8affd5f..ffc1231 100644 --- a/META.yml +++ b/META.yml @@ -19,4 +19,4 @@ recommends: Devel::Size::Report: 0.11 requires: DynaLoader: 0 -version: 0.68 +version: 0.69 diff --git a/README b/README new file mode 100644 index 0000000..9f99cf1 --- /dev/null +++ b/README @@ -0,0 +1,61 @@ +=pod + +Devel::Size - Perl extension for finding the memory usage of Perl variables + +=head1 SYNOPSIS + + use Devel::Size qw(size total_size); + + my $size = size("A string"); + + my @foo = (1, 2, 3, 4, 5); + my $other_size = size(\@foo); + + my $foo = {a => [1, 2, 3], + b => {a => [1, 3, 4]} + }; + my $total_size = total_size($foo); + +=head1 DESCRIPTION + +This module figures out the real size of Perl variables in bytes, as +accurately as possible. + +=head1 Build and Install + +To build and install this module, you need: + + Perl + a working C or C++ compiler + a make (or namke on Windows) utility + +Follow these steps: + +On Linux, Cygwin, or Unix: + + perl Makefile.PL + make + make test + sudo make install + +On Windows: + + perl Makefile.PL + nmake + nmake test + nmake install + +=head1 BUGREPORTS + +Please report bugs to: + + http://rt.cpan.org/NoAuth/Bugs.html?Dist=Devel-Size + +=head1 COPYRIGHT + +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 v5.8.8. + +=cut diff --git a/SIGNATURE b/SIGNATURE index b8ddb62..8ad3332 100644 --- a/SIGNATURE +++ b/SIGNATURE @@ -14,12 +14,13 @@ not run its Makefile.PL or Build.PL. -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 -SHA1 ee66ae558ef004085fcfdd02cd48dbccfb03af99 CHANGES -SHA1 b41fb799702683e35ca968f55018175c8c6298e9 MANIFEST -SHA1 134aae6f44102ce9b0f7fa7a3710e41a0cd23646 MANIFEST.SKIP -SHA1 b35ae97bcd1cc317531149f733fff1a2f28cfc5d META.yml +SHA1 199e3cacd2526d5d15e48916d13b7aef6699672d CHANGES +SHA1 e4296437ed0ab5559b250f6016d52c3b547d672e MANIFEST +SHA1 6883c1a98abd5b1c049e389f831e939b79c13ba5 MANIFEST.SKIP +SHA1 2ce5c32d4b38685bc3c98d46472c65632b5f204e META.yml SHA1 6ed187e4890948dacf792b44ab18fa143a580ace Makefile.PL -SHA1 4c4f4df3225936dc661f604629650c791af0f932 Size.xs +SHA1 e73e2ea830b69aefd7525f73b1fc06df4bf607f5 README +SHA1 c4c21e25262e74d0f51789302a171ea1fa93832e Size.xs SHA1 ceac99579ef3914de1936417282842c07d907a6a inc/Module/Install.pm SHA1 6c9471c92c28e247fb84f4ab7dc277f68b33ea95 inc/Module/Install/Base.pm SHA1 b2cb1026330e8c4f8533c79569498ab15f189d86 inc/Module/Install/Can.pm @@ -28,19 +29,19 @@ 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 97173fa2e404110c943223b095662f72acc13e5f lib/Devel/Size.pm -SHA1 69c981fd251d8017b9602799d15a7066fcd27c5e t/basic.t +SHA1 3a771cfbe85a36702ce8386c4dc0635bd461986c lib/Devel/Size.pm +SHA1 b10a47370115165b080e143db320fc9873d24ce1 t/basic.t SHA1 dc638392e64661dd07deeba11f67e35650a6384a t/pod.t SHA1 f4ffad1e7160c51cefcd003f88e1deb1c897b344 t/pod_cov.t -SHA1 4cafa040d3ab66402270c8b8f7f1c7308157f19c t/recurse.t +SHA1 5cde1f755eaaf29fdffd6885764fc78dedf5d7ae t/recurse.t -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2 (GNU/Linux) -iQEVAwUBRm7/0XcLPEOTuEwVAQKEmwf+P6mE4zf9m+uH2M2avNFpoziJy58g0uUa -D5otmranT2bXok6hALU5syPAixFzsTKnsvrdMzpIA/gtSJBNCKkBjbzaEFItw5B0 -y5D/fdA6QDpjA/2SmZGPvNwyrfy0wCcW0N6hqO8fAG4Mmvh2j8sE9JDtZVMjCQX7 -FesGUB9n/+ucj37goNk1M6f7EMSBEsdVROUNyhgicUaSdWLwfOK67M9mZIfoFadn -DjkYQHQExtrwt/IqjKXH51gCcENJHdZ7eelTw52YHniqnh76yqXcdISQoWzpkh7i -9kUO0Jnlk4iCS24RwRktnfiOU42+Htm41m1AUALtb0wVD3rnRZXouw== -=xbQw +iQEVAwUBRr8TY3cLPEOTuEwVAQLUlwf+MxR/N3qd8DCkLKrxBOlINwIifDWou6Hw +TR+14Q1KyurpItruNGqbCKpbhJin9LdynWbbWugJy5waf3WkqCedZ+Kat2fvGoZY +CDypeXf+9yzG23+VKpN3qsXFPemoN7g5Tbvxt2mOXauvEXcOz87agO/DxiAWyfTZ +FVulD2f4ZqOTQZSFio/4uIxn9aqmMLHPGTjOYFKs6XnhfqsvNYtqgfR3Lc61ljGS +WV0NnRDlwthwbttOWn+UaZdQNZMmeVNndVFPy4hBE/VoyqpWarfqvvNVq6I4v+hh +QWfHNPLFqcauVa6E+X17rjQMuKeQ7Y+RcHg24dMbc3NvDL0um+qK3w== +=Db+y -----END PGP SIGNATURE----- diff --git a/Size.xs b/Size.xs index 7d63f80..de1251e 100644 --- a/Size.xs +++ b/Size.xs @@ -262,6 +262,7 @@ UV op_size(OP *baseop, HV *tracking_hash) { if (check_new(tracking_hash, cPMOPx(baseop)->op_last)) { total_size += op_size(cPMOPx(baseop)->op_last, tracking_hash); } +#if PERL_VERSION < 9 || (PERL_VERSION == 9 && PERL_SUBVERSION < 5) if (check_new(tracking_hash, cPMOPx(baseop)->op_pmreplroot)) { total_size += op_size(cPMOPx(baseop)->op_pmreplroot, tracking_hash); } @@ -271,6 +272,7 @@ UV op_size(OP *baseop, HV *tracking_hash) { if (check_new(tracking_hash, cPMOPx(baseop)->op_pmnext)) { total_size += op_size((OP *)cPMOPx(baseop)->op_pmnext, tracking_hash); } +#endif /* This is defined away in perl 5.8.x, but it is in there for 5.6.x */ #ifdef PM_GETRE diff --git a/lib/Devel/Size.pm b/lib/Devel/Size.pm index cfff70c..cc64f63 100644 --- a/lib/Devel/Size.pm +++ b/lib/Devel/Size.pm @@ -16,7 +16,7 @@ require DynaLoader; @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); @EXPORT = qw( ); -$VERSION = '0.68'; +$VERSION = '0.69'; bootstrap Devel::Size $VERSION; @@ -41,14 +41,16 @@ Devel::Size - Perl extension for finding the memory usage of Perl variables my $foo = {a => [1, 2, 3], b => {a => [1, 3, 4]} }; - my $total_size = total_size($foo); + my $total_size = total_size($foo); =head1 DESCRIPTION -This module figures out the real sizes of Perl variables in bytes. +This module figures out the real size of Perl variables in bytes, as +accurately as possible. + Call functions with a reference to the variable you want the size of. If the variable is a plain scalar it returns the size of -the scalar. If the variable is a hash or an array, use a reference +this scalar. If the variable is a hash or an array, use a reference when calling. =head1 FUNCTIONS @@ -244,7 +246,7 @@ Maintained now by 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. +under the same terms as Perl v5.8.8. =head1 SEE ALSO diff --git a/t/basic.t b/t/basic.t index 0057f8e..a6b0d14 100644 --- a/t/basic.t +++ b/t/basic.t @@ -22,8 +22,8 @@ can_ok ('Devel::Size', qw/ Devel::Size->import( qw(size total_size) ); -die ("Uhoh, test uses outdated version of Devel::Size") - unless is ($Devel::Size::VERSION, '0.68', 'VERSION MATCHES'); +die ("Uhoh, test uses an outdated version of Devel::Size") + unless is ($Devel::Size::VERSION, '0.69', 'VERSION MATCHES'); ############################################################################# # some basic checks: diff --git a/t/recurse.t b/t/recurse.t index ddee1d8..f280164 100644 --- a/t/recurse.t +++ b/t/recurse.t @@ -28,8 +28,8 @@ can_ok ('Devel::Size', qw/ Devel::Size->import( qw(size total_size) ); -die ("Uhoh, test uses outdated version of Devel::Size") - unless is ($Devel::Size::VERSION, '0.68', 'VERSION MATCHES'); +die ("Uhoh, test uses an outdated version of Devel::Size") + unless is ($Devel::Size::VERSION, '0.69', 'VERSION MATCHES'); ############################################################################# # verify that pointer sizes in array slots are sensible: