That's why I generally avoid using ||= to specify defaults.
Unless I'm very sure my incoming data won't ever be 0, "0", or "".
Besides, there are ways to tell if she is a witch:
or:$name = '' unless defined $name; $rank = '' unless defined $rank; $c_num = '' unless defined $c_num;
or the strange-but-lovely:foreach ($name, $rank, $c_num) { defined or $_ = '' }
or the tried and true:$_ = '' for grep !defined => ($name, $rank, $c_num);
$name = '' if weight($name) == weight($duck); $rank = '' if weight($rank) == weight($duck); $c_num = '' if weight($c_num) == weight($duck);
Err...
Oh, yes, I should also mention that next week, when Apocalypse III and Exegesis III appear, you'll find that Perl 6 is going to have a much nicer way to solve this problem.
Damian
In reply to Re: Re: Re: OO Perl: calling a constructor within a class
by TheDamian
in thread OO Perl: calling a constructor within a class
by fx
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |