use strict; use warnings; warn "Version $]"; warn "Prototype", prototype "CORE::sleep"; my $sleepcounter; BEGIN { *CORE::GLOBAL::sleep = sub { warn "start wrapper"; $sleepcounter += $_[0]; CORE::sleep(@_); warn "stop wrapper"; }; } sleep 3; warn "total sleep( $sleepcounter )"
C:/Perl_64/bin\perl.exe d:/Users/lanx/pm/core_sleep.pl Version 5.016003 at d:/Users/lanx/pm/core_sleep.pl line 4. Prototype;$ at d:/Users/lanx/pm/core_sleep.pl line 5. start wrapper at d:/Users/lanx/pm/core_sleep.pl line 13. stop wrapper at d:/Users/lanx/pm/core_sleep.pl line 16. total sleep( 3 ) at d:/Users/lanx/pm/core_sleep.pl line 26.
Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery
In reply to Re^2: Copy a builtin sub to a different name and then override
by LanX
in thread Copy a builtin sub to a different name and then override
by bliako
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |