in reply to Code should be version-aware

As far as use warnings; is concerned ... i strongly believe there should be some (even "fake") warnings.pm module for perl 5.005 (or even older versions). I don't really mind if no warnings 'foo' turns off warnings completely in older perls, but the fact that as soon as you use warnings the code is incompatible with older perls is really annoying.

Actually ... there seems to be a rather easy way to make sure use warnings doesn't kill the script without having to add any file anywhere :

BEGIN { $INC{'warnings.pm'} = 'ignore' if ($] < 5.006 and !exists $INC{'warnings.pm'}) ; }
Of course this makes the use warnings ... completely ignored.

Jenda
Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.
   -- Rick Osborne

Edit by castaway: Closed small tag in signature

Replies are listed 'Best First'.
Re: Re: Code should be version-aware
by liz (Monsignor) on Aug 13, 2003 at 11:29 UTC
    ...there should be some (even "fake") warnings.pm module for perl 5.005 (or even older versions)..

    This was extensively discussed at the p5p BOF at the YAPC::Europe in Paris. It was decided however, to not take any action at this point. The reason for this is that all the repercussions with regards to CPAN are not clear yet. You don't want the fake warnings.pm replace your "real" one when you're installing a module from CPAN, or have your perl upgraded to 5.8.1 when installing the fake warnings.pm, etc. etc.. CPAN (particularly the indexer) needs to become more flexible. This work is currently underway.

    In the mean time, I put this warnings for modules < 5.6 in Snippets.

    Liz