in reply to RE: Re: help with a Perl term
in thread help with a Perl term

Well... would you believe that it wasn't a very good example? :)

That said, there are several situations where I might do something like this:

What I do wonder is why you're using warn above. If code you're writing absolutely requires a module to work, why wouldn't you want to die? Just wondering.

Replies are listed 'Best First'.
RE: RE: RE: Re: help with a Perl term
by KM (Priest) on Jun 08, 2000 at 21:16 UTC
    I use warn so I get a warning without killing whatever is happening. If you notice, that example is being used as if it were part of a module, and the new() method returns if it's dependant method isn't loaded. This will keep this module from dying when another module/script is trying to use it, while still giving it a warning. For example, we use this technique extensively with the newest version of the Infobot. I have also used it elsewhere. I wouldn't eval a require to just die if it fails, seems redundant.

    Your example would have been better if you showed it in the contect of the first bullet you explain above. :)

    Cheers,
    KM