in reply to Re^7: perl5.10 Devel::Size behaviour changed? (reason for magic)
in thread perl5.10 Devel::Size behaviour changed?

Thank you. Congratulations.

Now I'm wondering if there is anything I can do in the interim to (my version of) http://search.cpan.org/~browseruk/Devel-Size/lib/Devel/Size.pm to prevent it from triggering the problem when sizing arrays.


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
RIP PCW It is as I've been saying!(Audio until 20090817)
  • Comment on Re^8: perl5.10 Devel::Size behaviour changed? (reason for magic)

Replies are listed 'Best First'.
Re^9: perl5.10 Devel::Size behaviour changed? (reason for magic)
by ikegami (Patriarch) on Oct 28, 2009 at 19:37 UTC

    Oops, I forgot what this thread was really about when I posted. $#array is fixed. AvARYLEN isn't changed. AvARYLEN doesn't exist as a field, so don't try to measure its size. The following code shouldn't be executed in 5.10+:

    if (AvARYLEN(thing)) { if (check_new(tv, AvARYLEN(thing))) { total_size += thing_size(AvARYLEN(thing), tv); } }

    Test with bleadperl and with those lines present:

    perl -MDevel::Peek -MDevel::Size=total_size -wle' my @a = qw( a b c ); Dump(\@a,1); # Shows no magic print total_size \@a; # 224 Dump(\@a,1); # Shows magic $#a=$#a; # Add magic Dump(\@a,1); # Shows magic print total_size \@a; # 224 '

    Test with bleadperl and with those lines commented out:

    perl -MDevel::Peek -MDevel::Size=total_size -wle' my @a = qw( a b c ); Dump(\@a,1); # Shows no magic print total_size \@a; # 168 Dump(\@a,1); # Shows no magic $#a=$#a; # Add magic Dump(\@a,1); # Shows magic print total_size \@a; # 224 '

    Update: Fixed reply to reflect the actual usage of AvARYLEN by the module. It's not used to determine the length of arrays as I had originally indicated.

    Update: Added tests.