Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: change perl function in runtime

by DrHyde (Prior)
on Dec 05, 2012 at 11:58 UTC ( #1007279=note: print w/replies, xml ) Need Help??


in reply to change perl function in runtime

Sounds like you need to:
  • invent a time machine
  • travel back a week and a bit
  • go to my talk on unit testing at the London Perl Workshop
and then mock function y. If all you want to do is generate a die() when you call it, then simply manipulating the symbol table as others have suggested would probably be sufficient, or you might want to use Test::MockObject. If you want to be a bit more rigourous, so that as well as testing that your code behaves correctly when 'y' dies but also test that you call y correctly, I recommend Class::Mockable and Class::Mock::Generic::InterfaceTester.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1007279]
help
Chatterbox?
[shmem]: unbelievable. ergo insurance germany offers a contract: paying 1.5 euro a day over 18 years, they ensure a payback of 7.501 euro
[shmem]: *if* there is a bonus due, they would pay 9.250
[shmem]: don't expect anything noteworthy from a countrie's elections in which such things are shrugged off.
[shmem]: otoh, hindering me from spending the money before due time is worth some fee, isn't it?

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (5)
As of 2017-09-19 15:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    During the recent solar eclipse, I:









    Results (222 votes). Check out past polls.

    Notices?