Subject: | [PATCH] new function Scalar::Defer::is_deferred |
Date: | Fri, 28 Dec 2007 12:09:00 -0200 |
To: | "Audrey Tang" <audreyt [...] audreyt.org>, bugs-Scalar-Defer [...] rt.cpan.org |
From: | "Adriano Ferreira" <a.r.ferreira [...] gmail.com> |
Hi, Audrey.
I am sending a patch to Scalar-Defer-0.12 for your consideration. The
proposed changes are summarized below.
Kind regards,
Adriano Ferreira
###
new exportable function 'is_deferred'
Why? If you want to use the deferred value as
a generator (in the same place you could use
a regular value), you may detect this with
'is_deferred' and then force it.
my $regular_value = is_deferred($value)
? force($value)
: $value;
(I used that at the recent
Class::Constructor::Factory 0.001,
but had to include a hack which knows "too much"
about Scalar::Defer guts)
###
'private' in
use Class::InsideOut qw( private register id )
was unused. Removed in the patch. (Not sure if it
has hidden implications.)
###
FALSE_PACKAGE and DEFER_PACKAGE were both '0'
Apparently FALSE_PACKAGE should have been superseded
by DEFER_PACKAGE (and it is, with an only exception
of the line
@{FALSE_PACKAGE().'::ISA'} = ('Scalar::Defer::Deferred');
). And this is a little misleading because all
the rest of the code used DEFER_PACKAGE.
So FALSE_PACKAGE was removed too.
###
Message body is not shown because sender requested not to inline it.