[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]
Re: Class::Fields, a base/fields.pm rewrite
Michael G Schwern writes:
: No, I believe it has to be 'and'. The statement is actually written
: in a confusing manner. I'm trying to accomplish this:
:
: if( $fglob = ${"$class\::"}{"FIELDS"} ) {
: return (*$fglob{HASH}) ? 1 : 0;
: }
: else {
: return 0;
: }
:
: not this
:
: $fglob = ${"$class\::"}{"FIELDS"};
: $fglob = *$fglob{HASH} if $fglob;
: return $fglob;
:
: Either way, its written confusingly. I'll see if I can clear it up.
:
:
: BTW return $fglob = ${"$class\::"}{"FIELDS"} && *$fglob{HASH}; doesn't
: work since $fglob needs to be set before *$fglob{HASH} is checked.
But yours doesn't do what you want either. Note that the following
always returns 1, not 2:
sub foo { return $x = 1 and 2 }
To get the effect you want, you'd have to say
sub foo { return ($x = 1 and 2) }
Plus, of course, returning *$fglob{HASH} is never actually going to
return 1 or 0, but I presume you're really just using those to mean
true and false.
Larry
- Follow-Ups from:
-
Michael G Schwern <schwern@pobox.com>
- References to:
-
Michael G Schwern <schwern@pobox.com>
[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]