- Added in tests from Ken Williams
0.56 Mon Feb 24 12:10:13 2003
- - Chopped out some C++ comments. D'oh! Version incremented for CPAN
\ No newline at end of file
+ - Chopped out some C++ comments. D'oh! Version incremented for CPAN
+
+0.57 Thu Mar 20 13:21:14 2003
+ - setting $Devel::Size::warn to 0 disables not complete warnings
+
+0.58 Fri Jul 18 11:42:32 2003
+ - Fix for problems triggered by perl 5.8.0 and up, more tests, and
+ removal of an "our" for better backwards compatibility. (Courtesy
+ of Marcus Holland-Moritz <mhx-perl@gmx.net>)
\ No newline at end of file
package Devel::Size;
use strict;
-use vars qw($VERSION @ISA @EXPORT @EXPORT_OK $AUTOLOAD %EXPORT_TAGS);
+use vars qw($VERSION @ISA @EXPORT @EXPORT_OK $AUTOLOAD %EXPORT_TAGS $warn);
require Exporter;
require DynaLoader;
@EXPORT = qw(
);
-$VERSION = '0.57';
+$VERSION = '0.58';
bootstrap Devel::Size $VERSION;
-our $warn = 1;
+$warn = 1;
# Preloaded methods go here.
if (hv_exists(tracking_hash, (char *)&thing, sizeof(void *))) {
return FALSE;
}
- hv_store(tracking_hash, (char *)&thing, sizeof(void *), &PL_sv_undef, 0);
+ hv_store(tracking_hash, (char *)&thing, sizeof(void *), &PL_sv_yes, 0);
return TRUE;
}
total_size += magic_size(thing, tracking_hash);
total_size += sizeof(XPVGV);
total_size += GvNAMELEN(thing);
+#ifdef GvFILE
/* Is there a file? */
if (GvFILE(thing)) {
if (check_new(tracking_hash, GvFILE(thing))) {
total_size += strlen(GvFILE(thing));
}
}
+#endif
/* Is there something hanging off the glob? */
if (GvGP(thing)) {
if (check_new(tracking_hash, GvGP(thing))) {
/* Check warning status */
go_yell = 0;
- if (NULL != (warn_flag = get_sv("Devel::Size::warn", FALSE))) {
+ if (NULL != (warn_flag = perl_get_sv("Devel::Size::warn", FALSE))) {
go_yell = SvIV(warn_flag);
}
/* Check warning status */
go_yell = 0;
- if (NULL != (warn_flag = get_sv("Devel::Size::warn", FALSE))) {
+ if (NULL != (warn_flag = perl_get_sv("Devel::Size::warn", FALSE))) {
go_yell = SvIV(warn_flag);
}
# Change 1..1 below to 1..last_test_to_print .
# (It may become useful if the test is moved to ./t subdirectory.)
-BEGIN { $| = 1; print "1..5\n"; }
+BEGIN { $| = 1; print "1..7\n"; }
END {print "not ok 1\n" unless $loaded;}
use Devel::Size qw(size total_size);
$loaded = 1;
print "not ok 5\n";
}
+# check that the tracking_hash is working
+
+my($a,$b) = (1,2);
+my @ary1 = (\$a, \$a);
+my @ary2 = (\$a, \$b);
+
+if (total_size(\@ary1) < total_size(\@ary2)) {
+ print "ok 6\n";
+} else {
+ print "not ok 6\n";
+}
+
+# check that circular references don't mess things up
+
+my($c1,$c2); $c2 = \$c1; $c1 = \$c2;
+
+if( total_size($c1) == total_size($c2) ) {
+ print "ok 7\n";
+} else {
+ print "not ok 7\n";
+}
+