Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

Hi,

Which version of perl do you have?

See CORE and ex::override

#!/usr/bin/perl -- use strict; use warnings; use diagnostics; BEGIN { my $sleepcounter = 0; *CORE::GLOBAL::hex = sub { print qq{hex(@_)\n}; # goto &CORE::hex; ## FAIL CORE::hex(@_); }; *CORE::GLOBAL::sleep = sub(;@) { print qq{sleep(@_)\n}; $sleepcounter += $_[0]; CORE::sleep(@_); }; END { print "total sleep( $sleepcounter )\n"; } } print "\$]=$] \$^V=$^V\n"; sleep 1; print hex("0x50"),"\n"; sleep 2; print hex("0x50"),"\n"; __END__ $ perl core-global-sleep-override.pl $]=5.016001 $^V=v5.16.1 hex(0x50) 1 hex(0x50) 1 total sleep( 0 ) $ perl core-global-sleep-override.pl $]=5.020003 $^V=v5.20.3 sleep(1) hex(0x50) 1 sleep(2) hex(0x50) 1 total sleep( 3 )

In reply to Re: Copy a builtin sub to a different name and then override by beech
in thread Copy a builtin sub to a different name and then override by bliako

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (4)
As of 2024-03-29 14:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found