Update: the upload announcement.

I'm trying to help with a common problem that many of us encounter. We have a deadline. We need to implement a feature, but we need to deprecate something (or refactor, or rewrite) but we only have the time to implement the feature if we don't do the refactor. We tell ourselves we'll remember, or put it in our Wiki, or write TODO tests, but those are often overlooked. I propose something like this:

package Customer; use Devel::Deprecate 'deprecate'; sub persist { my $self = shift; my $change_event = shift || $self->change_event; deprecate( { reason => 'Should no longer have an optional change event', warn => '2008-06-12', # or DateTime object die => '2008-08-12', # or DateTime object if => ( scalar @_ ), # optional? } ); ... rest of method }

With this, when the warn date occurs, your test suite starts issuing warnings if the code is still there. Warnings will include the 'die' date, the package and line number.

When the 'die' date occurs, it's a fatal error.

Any issues with this approach? I'm ambivalent about the 'if' condition (you could wrap it if you needed to, but why leave dead code?). Any features you think would be worthwhile?

Cheers,
Ovid

New address of my CGI Course.


In reply to RFC: Devel::Deprecate by Ovid

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.