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

Re: change perl function in runtime

by space_monk (Chaplain)
on Dec 03, 2012 at 15:13 UTC ( #1006892=note: print w/ replies, xml ) Need Help??


in reply to change perl function in runtime

It would probably be quicker to post the class methods x and y on here and ask why they don't work. :-)

Why doesn't function y simply log whatever it is doing through use of debug statements?

A Monk aims to give answers to those who have none, and to learn from those who know more.


Comment on Re: change perl function in runtime
Re^2: change perl function in runtime
by david2008 (Scribe) on Dec 03, 2012 at 15:28 UTC
    Actually they work till i bump on a defect.
    I test the class with a .t file, so i want to check the behavior when there is a failure.
    Currently there are no known defects so i can not simulate it if i don't change the function.
Re^2: change perl function in runtime
by ColonelPanic (Friar) on Dec 03, 2012 at 15:40 UTC

    I have to disagree with you. This is a perfectly reasonable request. In fact, this is considered a good practice for testing complex software.

    There are lots of reasons for doing things like this:

    1. You may not have control over function y
    2. It might do something that you don't want to do during testing (such as submit a credit card order...)
    3. It might take a long time to run.
    4. It might be hard to reproduce certain kinds of output.
    5. It might not be written yet, or it might have bugs of its own (simulating part of the software allows you to develop/test multiple interdependent pieces of code simultaneously).



    When's the last time you used duct tape on a duct? --Larry Wall
      Thanks for the reasons. I normally suppress things I don't want to do during a test run, but I can see your points :-)
      A Monk aims to give answers to those who have none, and to learn from those who know more.

        Obviously, changing function calls at run time is not the only way to overcome the above problems. The important thing is using good testing principles, rather than a particular implementation.

        I think it is a useful and powerful tool for certain kinds of testing.



        When's the last time you used duct tape on a duct? --Larry Wall

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (5)
As of 2014-09-02 04:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite cookbook is:










    Results (19 votes), past polls