Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Upgrade-proofing overridden subroutines

by adrianh (Chancellor)
on Aug 15, 2006 at 11:12 UTC ( [id://567421]=note: print w/replies, xml ) Need Help??


in reply to Upgrade-proofing overridden subroutines

If the version method is called, the replace will die loudly if the version does not match. Thus, an external patch to a module will fail if that module is upgraded. This seems much safer than our current alternatives. Is this a reasonable approach or am I missing something?

If you can detect the broken functionality programatically - maybe only apply the patch in this instance?

Adrian (hoping it's not Test::Class that's causing the problems :-)

Replies are listed 'Best First'.
Re^2: Upgrade-proofing overridden subroutines
by Ovid (Cardinal) on Aug 15, 2006 at 11:49 UTC

    No, it's not Test::Class I'm carping about. Most of the time it's features I've wanted in Test::Class, not bug fixes.

    As for detecting the broken functionality programmatically, the only thing I thought of was using B::Deparse to get the source code of the subroutine and create a digest for it after and compare that with the new sub. That involves embedding the digest and recreating if necessary. Also, just because the source code doesn't change doesn't mean the bug wasn't fixed elsewhere.

    If I'm misunderstanding you or you have a better approach which doesn't involve running the code, please let me know. (Hmm, creating local test suites targeting external modules?)

    Cheers,
    Ovid

    New address of my CGI Course.

      If I'm misunderstanding you or you have a better approach which doesn't involve running the code, please let me know. (Hmm, creating local test suites targeting external modules?)

      What I was thinking off was something like this. If Bar::foo(N) has a bug where it dies where N=0, when it should just return -1, then I might only apply my patch where eval { Bar::foo(0) } == -1 is false.

      Of course this relies on whatever broken behaviour we're looking for being cheap to test for with no side effects. Make vague sense?

        That makes perfect sense, but the problem isn't what the code is currently doing. The problem is that we don't know what the code will do in the future.

        Cheers,
        Ovid

        New address of my CGI Course.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (11)
As of 2024-03-28 09:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found