in reply to Re: Copy a builtin sub to a different name and then override
in thread Copy a builtin sub to a different name and then override
> # goto &CORE::hex; ## FAIL
I can't reproduce any problems with goto &SUB here.
Neither with hex nor with sleep .
How does it "fail" for you?
Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery
use strict; use warnings; warn "Version $]"; warn "Prototype", prototype "CORE::sleep"; my $sleepcounter; BEGIN { *CORE::GLOBAL::sleep = sub { warn "start wrapper ($_[0])"; $sleepcounter += int $_[0]; goto &CORE::sleep; }; } warn "return: ", sleep 2.3; warn "total sleep( $sleepcounter )";
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 (2.3) at d:/Users/lanx/pm/core_sleep.pl line 15. return: 2 at d:/Users/lanx/pm/core_sleep.pl line 23. total sleep( 2 ) at d:/Users/lanx/pm/core_sleep.pl line 25.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Copy a builtin sub to a different name and then override ( goto &SUB )
by beech (Parson) on Jun 07, 2018 at 22:13 UTC |