[jifty-devel] Janitorial: lib/Jifty/Request.pm

Ruslan Zakirov ruslan.zakirov at gmail.com
Sat Mar 3 17:50:36 EST 2007

On 3/3/07, Jesse Vincent <jesse at bestpractical.com> wrote:
> On Mar 3, 2007, at 4:19 AM, Edgar Whipple wrote:

> > -- changed 'return undef' to bare 'return'.
> Ok. I know it's bad style, but I prefer "return undef". I should
> probably be broken of this preference. (IE, I don't think there's a
> need to go wioth my preference)

Bare 'return' is also broken if method most of the time returns a
scalar, for example:
use strict; use warnings;

sub foo { return }
my $x = { x => foo(), y => 'z'};

use Data::Dumper;
print Dumper( $x );

So I think that if primary context of a method is scalar then it must
return undef. For arrays it should be bare return, as well as for
mixed context. In the latter case a caller should explicitly define
context to get the right result.

Best regards, Ruslan.

More information about the jifty-devel mailing list