in reply to Re: Re: autoflush and 'DESTROY'
in thread autoflush and 'DESTROY'

Or perhaps the more obscure

*{Chatbot::Eliza::DESTROY} = sub {};

Have you considered a job with M$ ? Patching the source of the problem and informing the author is better than working around the error IMHO

cheers

tachyon

s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print

Replies are listed 'Best First'.
Re: Re: Re: Re: autoflush and 'DESTROY'
by Juerd (Abbot) on Mar 16, 2002 at 21:29 UTC

    Have you considered a job with M$?

    Offense taken. Working around a problem is a great solution if you don't want to mess with the original code. To have maintainable code, I think it's important not to mess with modules that came from CPAN. Of course you could/should drop a note at the author's address, but my experience is that new versions are not released within a month.

    When putting a single line of code in your own script can prevent you from changing the module, I think you should be.

    U28geW91IGNhbiBhbGwgcm90MTMgY
    W5kIHBhY2soKS4gQnV0IGRvIHlvdS
    ByZWNvZ25pc2UgQmFzZTY0IHdoZW4
    geW91IHNlZSBpdD8gIC0tIEp1ZXJk
    

      First no offense was meant, if was a feeble attempt at humour. It seemed funny at the time.

      Secondly the problem is a warning. With your (or my solution) of hacking the modules symbol table you get a new warning as soon as the module is patched with a DESTROY() method vis:

      package Chatbot::Eliza; sub new { bless {}, shift } sub DESTROY {} package Foo; use warnings; sub Chatbot::Eliza::DESTROY {} __DATA__ Subroutine Chatbot::Eliza::DESTROY redefined at script line 9 .

      Thus by patching your code you generate a new warning when the module is eventually patched. Hence my point - fix the problem at its root not the symptom.

      cheers

      tachyon

      s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print

      Of course you could/should drop a note at the author's address, but my experience is that new versions are not released within a month.

      I really depends on the module. Most module author will at least accept a patch and include it in the next version, so you can use the pactched module knowing that the patch will still be applicable in the future. Some authors also maintain a development version of modules, and some just release a new version any time a bug is found.

      So really sending a note to the author is the most efficient, polite, not to mention ethical thing to do, this is what Open-SOurce is all about!

        So really sending a note to the author is the most efficient, polite, not to mention ethical thing to do, this is what Open-SOurce is all about!

        I would second that. With most of the modules that I maintain I am likely to make a release within a couple of days if the patch warrants it - occasionally it might be longer if the patch won't aply or there is extra work required on the documentation or whatever. Occasionally I might sit on a patch for a while if I am not sure if I agree with what it is trying to do of course. And then there is always that nasty work stuff using up all my time ...

        /J\