Keep It Simple, Stupid | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Interesting points. To be fair, the original implementation only sets the name attribute equal to $_[0] as well, by virtue of $self->{name} = shift. I was less interested in the case of empty array as I was in the case of setting the attribute 'name' to be a scalar value, which seemed to make more sense. Should have been more clear. ;-) As to die "No arguments in set_name()" unless @_;, note that I did leave a space in the setter to validate behavior, since we aren't going from a spec. Depending on the behavior required, that line may or may not be appropriate. The behavior you described as erratic is what I intended, but its interesting that we looked at the same OP and drew differing conclusions. I guess this is an example to designers about how unclear specs can lead to unexpected behavior. ;-)
<-radiant.matrix->
Larry Wall is Yoda: there is no try{} (ok, except in Perl6; way to ruin a joke, Larry! ;P) The Code that can be seen is not the true Code "In any sufficiently large group of people, most are idiots" - Kaa's Law In reply to Re^4: Things I Don't Use in Perl
by radiantmatrix
|
|