Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

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

by LanX (Saint)
on Jun 03, 2018 at 12:14 UTC ( [id://1215775]=note: print w/replies, xml ) Need Help??


in reply to Re^3: Copy a builtin sub to a different name and then override
in thread Copy a builtin sub to a different name and then override

> returns the integer number of seconds actually slept.

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

Afaik all implementations shown so far are broken in this respect.

(Yours too btw :)

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery

  • Comment on Re^4: Copy a builtin sub to a different name and then override (API compatibility)

Replies are listed 'Best First'.
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
    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://1215775]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (4)
As of 2024-04-25 05:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found