Group :: Desenvolvimento/Perl
RPM: perl-Sub-Uplevel
Principal Changelog Spec Patches Sources Download Gear Bugs e FR Repocop
A versão atual: 0.09-alt1
Data da compilação: 7 junho 2005, 02:12 ( 987.9 weeks ago )
Tamanho:: 21.82 Kb
Home page: http://www.cpan.org
Licença: Artistic
Sumário: Sub-Uplevel - apparently run a function in a higher stack frame
Descrição:
Lista dos contribuidores Lista dos rpms provida por esta srpm:
ACL:
Data da compilação: 7 junho 2005, 02:12 ( 987.9 weeks ago )
Tamanho:: 21.82 Kb
Home page: http://www.cpan.org
Licença: Artistic
Sumário: Sub-Uplevel - apparently run a function in a higher stack frame
Descrição:
Like Tcl's uplevel() function, but not quite so dangerous. The idea
is just to fool caller(). All the really naughty bits of Tcl's
uplevel() are avoided.
THIS IS NOT THE SORT OF THING YOU WANT TO DO EVERYDAY
=over 4
=item uplevel
uplevel $num_frames, \&func, @args;
Makes the given function think it's being executed $num_frames higher
than the current stack level. So when they use caller($frames) it
will actually caller($frames + $num_frames) for them.
"uplevel(1, \&some_func, @_)" is effectively "goto &some_func" but
you don't immediately exit the current subroutine. So while you can't
do this:
sub wrapper {
print "Before\n";
goto &some_func;
print "After\n";
}
you can do this:
sub wrapper {
print "Before\n";
my @out = uplevel 1, &some_func;
print "After\n";
return @out;
}
Mantenedor currente: Vitaly Lipatov is just to fool caller(). All the really naughty bits of Tcl's
uplevel() are avoided.
THIS IS NOT THE SORT OF THING YOU WANT TO DO EVERYDAY
=over 4
=item uplevel
uplevel $num_frames, \&func, @args;
Makes the given function think it's being executed $num_frames higher
than the current stack level. So when they use caller($frames) it
will actually caller($frames + $num_frames) for them.
"uplevel(1, \&some_func, @_)" is effectively "goto &some_func" but
you don't immediately exit the current subroutine. So while you can't
do this:
sub wrapper {
print "Before\n";
goto &some_func;
print "After\n";
}
you can do this:
sub wrapper {
print "Before\n";
my @out = uplevel 1, &some_func;
print "After\n";
return @out;
}
Lista dos contribuidores Lista dos rpms provida por esta srpm:
- perl-Sub-Uplevel