5 use Class::Tiny::_Utils;
7 our @EXPORT = qw(defer undefer);
13 my ($target, $maker, $undeferred_ref) = @{
14 $DEFERRED{$deferred}||return $deferred
16 ${$undeferred_ref} = my $made = $maker->();
17 { no warnings 'redefine'; *{_getglob($target)} = $made }
22 my ($target, $maker) = @_;
25 my $deferred = bless(sub {
26 goto &{$undeferred ||= undefer($deferred_string)};
27 }, 'Sub::Defer::Deferred');
28 $deferred_string = "$deferred";
29 $DEFERRED{$deferred} = [ $target, $maker, \$undeferred ];
30 *{_getglob $target} = $deferred;