Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

Re^4: Things I Don't Use in Perl

by radiantmatrix (Parson)
on Aug 24, 2005 at 18:16 UTC ( #486320=note: print w/replies, xml ) Need Help??

in reply to Re^3: Things I Don't Use in Perl
in thread Things I Don't Use in Perl

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. ;-)

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

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://486320]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (7)
As of 2018-03-18 18:28 GMT
Find Nodes?
    Voting Booth?
    When I think of a mole I think of:

    Results (230 votes). Check out past polls.