XP is just a number | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
My function doesn't return true/false. It returns the scalar reference of the weapon in the hand of the body object of a guy. Sometimes it's not defined, but it's not a list of weapons. if( $dude->weapon ) works. In fact, @weapons_in_left_hand = $dude->weapon also works because it returns the list of one weapon in his hand even when it's undefined (eg, if it were thrown). @weapons_in_left_hand == 1 should always be true for this function.
Suggesting that all functions have to return success or failure — just in case someone tests it in an list context — seems just a little myopic. Although, I don't think I say it nearly as well as tye (ie: {left => $dood->query_weapon(0), right => $dood->query_weapon(1)} ), so I probably should have just left it alone. -Paul In reply to Re^8: Module Announcement: Perl-Critic-1.01 (scalar)
by jettero
|
|