Re: Question about Watcher Attributes
[email protected] (Uri Guttman)
| Newsgroups | perl.loop |
|---|---|
| Message-ID | <[email protected].> |
>>>>> "JNP" == Joshua N Pritikin <[email protected]> writes: JNP> if (@_) { JNP> $self->{$pkg} = shift JNP> } else { >> >> drop the else. accessors should always return the value whether freshly >> set or not. JNP> Yes, that how it works either way. Hash assignment returns the new JNP> value; the else branch would be redundent. but nik has a good point. i didn't think about the extra hash lookup. i just hate extra else clauses, braces and indents (must be the perl golfer in me). but it wins here. uri -- Uri Guttman --------- [email protected] ---------- http://www.sysarch.com SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting The Perl Books Page ----------- http://www.sysarch.com/cgi-bin/perl_books The Best Search Engine on the Net ---------- http://www.northernlight.com