in reply to Re^2: Upgrade-proofing overridden subroutines
in thread Upgrade-proofing overridden subroutines

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?

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

    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.

      If what the code is currently doing is not a problem, then you don't have a problem, do you?

      I think you misstated something here. I guess you are trying stress your vexation anticipating his fix clobbering your fix and that that future is not coming soon enough. This indicates a basic trust issue with the code you are using. You imply the module doesn't have versions, if it does, don't waste time generalizing your solution. Instead, for the modules you care about, report the bug of lack of versions. You need to be able to divine the version of things to maintain the control/quality/efficiency standards which you seek.

      Within the limitations he describes, adrianh's solution is suited to your problem.

      What are the problems with forking? If you have hope that the author will be back someday, you can do it quietly by renaming the packages and distributing them within your distribution. So long as you hope, you treat the code as if it were still under its author's care. If he wakes up or comes back or finds time, you can refactor the code easily at your convenience. If it turns out the code is abandoned, it will be nice that you kept it alive.

      Be well,
      rir

        I was meaning "what the code is currently doing" in the context of Adrian's suggestion that it could be safe to run a sub to know if it behaves correctly. That way I could always run the code after an upgrade to see if its behavior has changed. The problem with that is even if I know what the code is currently doing and therefore deem it safe to run, I don't know what it will be doing in the future, and thus I don't know if it will be safe to run. Thus, Adrian's solution can't work.

        As for the problems with forking, you can google for that pretty easily. The pros and cons are numerous and well spelled out. To fork, you really need a compelling reason to but too many forks spoil the broth. Even a great fork can meet serious resistance. Look at Module::Build. Many people who didn't understand the problems with ExtUtils::MakeMaker were pretty vehement that Module::Build was a bad thing. Go figure. (well, there was that little matter of PREFIX. It's horribly broken but people want its broken behavior).

        If you fork privately, you have to maintain it in-house. For small projects this is not so bad. For large projects, it gets hairy. If you want to fork it publicly, you might get community support. You might get ingnored. You might get community derision. Imagine if Module::Build was one of the offenders (it has bugs reported, but it's certainly not one of the offenders in question since it's being so actively developed). Could you reasonably fork that and expect it to work on the hundreds of different platforms it's supposed to work on? Could you expect the community to help with a fork they may not see the merit of?

        That's not to say that forking is always bad. I'm just pointing out that forking is a very serious issue and if the code isn't trivial, it shouldn't be done on a whim.

        Cheers,
        Ovid

        New address of my CGI Course.