in reply to Re: Re: First steps in OO-Perl , suggestions please!
in thread First steps in OO-Perl , suggestions please!

You asked for advice on OO. If you're going to encapsulate functionality, you should not affect things outside the scope of your module. By setting a handler for all warn calls the way you have done, all of the warning messages that might be generated by the script using your module would also be trapped. It may be what you want in your scenario, but if I personally were to use a module and suddenly have all of my calls to warn() stop working as expected, I would at first be confused, then annoyed once I found out what the problem was and had to rewrite my code to account for this. The only time I could see that you would want to rewrite the warn handler on a global scale would be if you were writing a message specificly for the purpose of trapping warn messages.

Just my 2 cents.

cephas
  • Comment on Re: Re: Re: First steps in OO-Perl , suggestions please!

Replies are listed 'Best First'.
Re: Re: Re: Re: First steps in OO-Perl , suggestions please!
by kodo (Hermit) on Jul 25, 2002 at 15:04 UTC
    Okay, true. My thought was that I have verbose 1 as default, and if it's wanted 0 so that nothing is shown in STDOUT. But you are right, there maybe better ways to solve this, I just thought you maybe thought that this happened without a specific reason so I wanted to clearify that.
    Thanks!

    giant