1Package::DeprecationManUasgeerr(C3o)ntributed Perl DocumPeanctkaatgieo:n:DeprecationManager(3)
2
3
4

NAME

6       Package::DeprecationManager - Manage deprecation warnings for your
7       distribution
8

VERSION

10       version 0.13
11

SYNOPSIS

13         package My::Class;
14
15         use Package::DeprecationManager -deprecations => {
16             'My::Class::foo' => '0.02',
17             'My::Class::bar' => '0.05',
18             'feature-X'      => '0.07',
19         };
20
21         sub foo {
22             deprecated( 'Do not call foo!' );
23
24             ...
25         }
26
27         sub bar {
28             deprecated();
29
30             ...
31         }
32
33         sub baz {
34             my %args = @_;
35
36             if ( $args{foo} ) {
37                 deprecated(
38                     message => ...,
39                     feature => 'feature-X',
40                 );
41             }
42         }
43
44         package Other::Class;
45
46         use My::Class -api_version => '0.04';
47
48         My::Class->new()->foo(); # warns
49         My::Class->new()->bar(); # does not warn
50         My::Class->new()->bar(); # does not warn again
51

DESCRIPTION

53       This module allows you to manage a set of deprecations for one or more
54       modules.
55
56       When you import "Package::DeprecationManager", you must provide a set
57       of "-deprecations" as a hash ref. The keys are "feature" names, and the
58       values are the version when that feature was deprecated.
59
60       In many cases, you can simply use the fully qualified name of a
61       subroutine or method as the feature name. This works for cases where
62       the whole subroutine is deprecated. However, the feature names can be
63       any string. This is useful if you don't want to deprecate an entire
64       subroutine, just a certain usage.
65
66       You can also provide an optional array reference in the "-ignore"
67       parameter.
68
69       The values to be ignored can be package names or regular expressions
70       (made with "qr//").  Use this to ignore packages in your distribution
71       that can appear on the call stack when a deprecated feature is used.
72
73       As part of the import process, "Package::DeprecationManager" will
74       export two subroutines into its caller. It provides an "import()" sub
75       for the caller and a "deprecated()" sub.
76
77       The "import()" sub allows callers of your class to specify an
78       "-api_version" parameter. If this is supplied, then deprecation
79       warnings are only issued for deprecations for api versions earlier than
80       the one specified.
81
82       You must call the "deprecated()" sub in each deprecated subroutine.
83       When called, it will issue a warning using "Carp::cluck()".
84
85       The "deprecated()" sub can be called in several ways. If you do not
86       pass any arguments, it will generate an appropriate warning message. If
87       you pass a single argument, this is used as the warning message.
88
89       Finally, you can call it with named arguments. Currently, the only
90       allowed names are "message" and "feature". The "feature" argument
91       should correspond to the feature name passed in the "-deprecations"
92       hash.
93
94       If you don't explicitly specify a feature, the "deprecated()" sub uses
95       "caller()" to identify its caller, using its fully qualified subroutine
96       name.
97
98       A given deprecation warning is only issued once for a given package.
99       This module tracks this based on both the feature name and the error
100       message itself. This means that if you provide several different error
101       messages for the same feature, all of those errors will appear.
102

BUGS

104       Please report any bugs or feature requests to
105       "bug-package-deprecationmanager@rt.cpan.org", or through the web
106       interface at <http://rt.cpan.org>.  I will be notified, and then you'll
107       automatically be notified of progress on your bug as I make changes.
108

DONATIONS

110       If you'd like to thank me for the work I've done on this module, please
111       consider making a "donation" to me via PayPal. I spend a lot of free
112       time creating free software, and would appreciate any support you'd
113       care to offer.
114
115       Please note that I am not suggesting that you must do this in order for
116       me to continue working on this particular software. I will continue to
117       do so, inasmuch as I have in the past, for as long as it interests me.
118
119       Similarly, a donation made in this way will probably not make me work
120       on this software much more, unless I get so many donations that I can
121       consider working on free software full time, which seems unlikely at
122       best.
123
124       To donate, log into PayPal and send money to autarch@urth.org or use
125       the button on this page:
126       <http://www.urth.org/~autarch/fs-donation.html>
127

CREDITS

129       The idea for this functionality and some of its implementation was
130       originally created as Class::MOP::Deprecated by Goro Fuji.
131

AUTHOR

133       Dave Rolsky <autarch@urth.org>
134
136       This software is Copyright (c) 2012 by Dave Rolsky.
137
138       This is free software, licensed under:
139
140         The Artistic License 2.0 (GPL Compatible)
141
142
143
144perl v5.16.3                      2012-03-09    Package::DeprecationManager(3)
Impressum