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