in reply to RFC: Devel::Deprecate

I like it. But...
I'm ambivalent about the 'if' condition

I'm beyond ambivalent. What would be the advantage of that over

if ( @_ ) { deprecate( { reason => 'Should no longer have an optional change event', warn => '2008-06-12', # or DateTime object die => '2008-08-12', # or DateTime object } ); }
why leave dead code?

I don't see more or less dead code either way.

I agree with others - This thing should be a no-op except when explicitly enabled, e.g. in development/testing. I think an environment switch, similar to DEBUG, with multiple severity levels, would work.

A word spoken in Mind will reach its own level, in the objective world, by its own weight

Replies are listed 'Best First'.
Re^2: RFC: Devel::Deprecate
by Ovid (Cardinal) on Apr 24, 2008 at 15:20 UTC

    I think you're right about the 'if' condition. Not sure what I was thinking, though it's now in there and I've already uploaded.

    By default, the deprecate() sub will only run if you're running tests (it checks for the $ENV{HARNESS_ACTIVE} variable). If, for some reason, this variable is true in your code, you can set $ENV{PERL_DEVEL_DEPRECATE_OFF} to a true value to disable the deprecation. Of course, as previously pointed out, merely omitting the 'die' date ensures that no fatal error will occur.

    Cheers,
    Ovid

    New address of my CGI Course.

      I think you're right about the 'if' condition. Not sure what I was thinking, though it's now in there and I've already uploaded.

      Maybe you can... uh, what's the word... remove it from the supported features? :)

      /J