> That's not how I see it. The filehandle is naturally true if
> it succeeds. It's the undef value that wants to have more
> information. In fact, you could view $! as a poor-man's
> way of extracting the error that was attached to the last
> undef.
Hmm. Thus?
sub fuu()
{
my $retval is error("Unknown error") = open("file.ext");
$retval is error($!) unless $retval;
return $retval;
}
sub bahr()
{
my $result = fuu(); # $results gets properties from $foo::retval
if ($result) { blah(); }
else { print $result.error(), "\n"; }
}
Now, what about magic properties? If we have const, volatile,
memoizable, etc, what are the rules for when those get replaced?
my $PI is constant = 3;
my $new_pi = $PI; # Is $NEW_PI constant?
my $C = $PI * $RADIUS * 2; # Is $C constant?
# Would $C be constant if $RADIUS was?
sub pi() is memoizable { return $PI; }
Can I say <<'THIS',
my $subref is memoizable = \π
THIS
and declare a ref to memoizable subs? Will the compiler warn on this
basis? Or will the subs only be memoizable if called via subref?
And why can't I dynamically declare function properties? If I'm writing
a reporting application, and I successfully get an exclusive lock on
the db, then let me improve the performance of my application.
=Austin
__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/