D
dt
I find the following useful and would like to see it as a new perl
feature:
I often have to cache a variable based on a complex function. it owuld
be nice if perl had something like this built in. here is an example:
our $html;
if ($html !~ /./)
{
$html = load_as_string($fh, "filename.html");
}
a datatype such as:
cache $html = load_as_string($fh, "filename.html");
would be really cool. basically, if the var is not set, it sets the
var. if it is set, it skips the call.
it would have to still be there if the function is exited and recalled
(same scope as our).
feature:
I often have to cache a variable based on a complex function. it owuld
be nice if perl had something like this built in. here is an example:
our $html;
if ($html !~ /./)
{
$html = load_as_string($fh, "filename.html");
}
a datatype such as:
cache $html = load_as_string($fh, "filename.html");
would be really cool. basically, if the var is not set, it sets the
var. if it is set, it skips the call.
it would have to still be there if the function is exited and recalled
(same scope as our).