Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re^5: Copy a builtin sub to a different name and then override (API compatibility)

by shmem (Chancellor)
on Jun 03, 2018 at 14:43 UTC ( [id://1215780]=note: print w/replies, xml ) Need Help??


in reply to Re^4: Copy a builtin sub to a different name and then override (API compatibility)
in thread Copy a builtin sub to a different name and then override

Excellent point, because any replacement has to mimic this behavior.

That depends on scope. If I write my watchdog.pl program which runs on my system, I might want a sleep override which returns the number of green bubbles appearing in my room at night whilst being asleep (ghosts, bengal fires), or a tupel having [ $seconds_slept, @things_missed ] monitoring the chatterbox, or anything else.

Things are different if I want to convince all perl programmers to use my sleep subroutine as a drop-in replacement for the builtin.

Update: in the context of this thread, you are right of course (make all imported modules use the overriden sleep()), so this comment is rather pointless. Well, at least it carries an idea for yet another silly program.

perl -le'print map{pack c,($-++?1:13)+ord}split//,ESEL'

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1215780]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (8)
As of 2024-04-23 19:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found