OK. Short answer: both guilty, sort of. Consider 'foo.pl':
#!/usr/bin/perl use strict; use warnings; use Set::Scalar::Valued; test_args(Set::Scalar::Valued->new()); sub test_args { my @opt_args; while (my $arg = shift) { if (ref($arg) eq 'ARRAY') { push @opt_args, @$arg; } else { push @opt_args, $arg; } } print scalar(@opt_args), "\n"; }
Now consider the following session via 'perl -d foo.pl':
main::(foo.pl:6): test_args(Set::Scalar->new()); + DB<0> s Set::Scalar::Base::new(/Library/Perl/5.8.6/Set/Scalar/Base.pm:68): 68: my $class = shift; + DB<0> r list context return from Set::Scalar::Base::new: 0 Set::Scalar=HASH(0x18092cc) 'elements' => HASH(0x194c7d4) empty hash 'universe' => Set::Scalar::Universe=HASH(0x18d312c) 'elements' => HASH(0x18b1db0) empty hash 'null' => Set::Scalar::Null=HASH(0x18acce4) 'universe' => Set::Scalar::Universe=HASH(0x18d312c) -> REUSED_ADDRESS 'universe' => undef main::test_args(foo.pl:10): my @opt_args; + DB<0> n main::test_args(foo.pl:11): while (my $arg = shift) main::test_args(foo.pl:12): { + DB<0> s Set::Scalar::Base::size(/Library/Perl/5.8.6/Set/Scalar/Base.pm:122): 122: my $self = shift;
I'm now puzzling over just how one goes from "my $arg = shift" to Set::Scalar::Base::size... and I return from a bit more digging.
Set::Scalar::Base overloads 'bool' by calling 'size'. Aha!
When I change the while condition to do "defined my $arg = shift", it works correctly. Methinks a patch is in order...
This has been an interesting course of investigation. I hope y'all have not found it boring.
In reply to Re: Difficulty with Object::InsideOut
by herveus
in thread Difficulty with Object::InsideOut
by herveus
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |