don't calculate the cache key unless we're going to be caching
[gitmo/Moose.git] / lib / Class / MOP / Deprecated.pm
CommitLineData
38bf2a25 1package Class::MOP::Deprecated;
2
3use strict;
4use warnings;
5
38bf2a25 6use Package::DeprecationManager -deprecations => {
7 'Class::MOP::HAVE_ISAREV' => '0.93',
8 'Class::MOP::subname' => '0.93',
9 'Class::MOP::in_global_destruction' => '0.93',
10
11 'Class::MOP::Package::get_method_map' => '0.93',
12
13 'Class::MOP::Class::construct_class_instance' => '0.93',
14 'Class::MOP::Class::check_metaclass_compatibility' => '0.93',
15 'Class::MOP::Class::create_meta_instance' => '0.93',
16 'Class::MOP::Class::clone_instance' => '0.93',
17 'Class::MOP::Class::alias_method' => '0.93',
18 'Class::MOP::Class::compute_all_applicable_methods' => '0.93',
19 'Class::MOP::Class::compute_all_applicable_attributes' => '0.93',
20 'Class::MOP::Class::get_attribute_map' => '0.95',
21
22 'Class::MOP::Instance::bless_instance_structure' => '0.93',
23
24 'Class::MOP::Attribute::process_accessors' => '0.93',
25
26 'Class::MOP::Method::Accessor::initialize_body' => '0.93',
27 'Class::MOP::Method::Accessor::generate_accessor_method' => '0.93',
28 'Class::MOP::Method::Accessor::generate_reader_method' => '0.93',
29 'Class::MOP::Method::Accessor::generate_writer_method' => '0.93',
30 'Class::MOP::Method::Accessor::generate_predicate_method' => '0.93',
31 'Class::MOP::Method::Accessor::generate_clearer_method' => '0.93',
32 'Class::MOP::Method::Accessor::generate_accessor_method_inline' => '0.93',
33 'Class::MOP::Method::Accessor::generate_reader_method_inline' => '0.93',
34 'Class::MOP::Method::Accessor::generate_writer_method_inline' => '0.93',
35 'Class::MOP::Method::Accessor::generate_clearer_method_inline' => '0.93',
36 'Class::MOP::Method::Accessor::generate_predicate_method_inline' =>
37 '0.93',
38
39 'Class::MOP::Method::Constructor::meta_instance' => '0.93',
40 'Class::MOP::Method::Constructor::attributes' => '0.93',
41 'Class::MOP::Method::Constructor::initialize_body' => '0.93',
42 'Class::MOP::Method::Constructor::generate_constructor_method' => '0.93',
43 'Class::MOP::Method::Constructor::generate_constructor_method_inline' =>
44 '0.93',
45};
46
47
48package
49 Class::MOP;
50
51sub HAVE_ISAREV () {
52 Class::MOP::Deprecated::deprecated(
14bda293 53 "Class::MOP::HAVE_ISAREV is deprecated and will be removed in a future release. It has always returned 1 anyway. This function will be removed in the Moose 2.0200 release."
38bf2a25 54 );
55 return 1;
56}
57
58sub subname {
59 Class::MOP::Deprecated::deprecated(
14bda293 60 "Class::MOP::subname is deprecated. Please use Sub::Name directly. This function will be removed in the Moose 2.0200 release.");
38bf2a25 61 require Sub::Name;
62 goto \&Sub::Name::subname;
63}
64
65sub in_global_destruction {
66 Class::MOP::Deprecated::deprecated(
14bda293 67 "Class::MOP::in_global_destruction is deprecated. Please use Devel::GlobalDestruction directly. This function will be removed in the Moose 2.0200 release."
38bf2a25 68 );
69 require Devel::GlobalDestruction;
70 goto \&Devel::GlobalDestruction::in_global_destruction;
71}
72
73package
74 Class::MOP::Package;
75
76use Scalar::Util qw( blessed );
77
78sub get_method_map {
79 Class::MOP::Deprecated::deprecated(
80 'The get_method_map method has been made private.'
14bda293 81 . ' The public version is deprecated. This method will be removed in the Moose 2.0200 release.'
38bf2a25 82 );
83 my $self = shift;
84
85 return { map { $_->name => $_ } $self->_get_local_methods };
86}
87
88package
89 Class::MOP::Module;
90
91package
92 Class::MOP::Class;
93
94sub construct_class_instance {
95 Class::MOP::Deprecated::deprecated(
96 'The construct_class_instance method has been made private.'
14bda293 97 . ' The public version is deprecated. This method will be removed in the Moose 2.0200 release.'
38bf2a25 98 );
99 shift->_construct_class_instance(@_);
100}
101
102sub check_metaclass_compatibility {
103 Class::MOP::Deprecated::deprecated(
104 'The check_metaclass_compatibility method has been made private.'
14bda293 105 . ' The public version is deprecated. This method will be removed in the Moose 2.0200 release.'
38bf2a25 106 );
107 shift->_check_metaclass_compatibility(@_);
108}
109
110sub construct_instance {
111 Class::MOP::Deprecated::deprecated(
112 'The construct_instance method has been made private.'
14bda293 113 . ' The public version is deprecated. This method will be removed in the Moose 2.0200 release.'
38bf2a25 114 );
115 shift->_construct_instance(@_);
116}
117
118sub create_meta_instance {
119 Class::MOP::Deprecated::deprecated(
120 'The create_meta_instance method has been made private.'
14bda293 121 . ' The public version is deprecated. This method will be removed in the Moose 2.0200 release.'
38bf2a25 122 );
123 shift->_create_meta_instance(@_);
124}
125
126sub clone_instance {
127 Class::MOP::Deprecated::deprecated(
128 'The clone_instance method has been made private.'
14bda293 129 . ' The public version is deprecated. This method will be removed in the Moose 2.0200 release.'
38bf2a25 130 );
131 shift->_clone_instance(@_);
132}
133
134sub alias_method {
135 Class::MOP::Deprecated::deprecated(
14bda293 136 'The alias_method method is deprecated. Use add_method instead. This method will be removed in the Moose 2.0200 release.');
38bf2a25 137
138 shift->add_method(@_);
139}
140
141sub compute_all_applicable_methods {
142 Class::MOP::Deprecated::deprecated(
143 'The compute_all_applicable_methods method is deprecated.'
14bda293 144 . ' Use get_all_methods instead. This method will be removed in the Moose 2.0200 release.' );
38bf2a25 145
146 return map {
147 {
148 name => $_->name,
149 class => $_->package_name,
150 code => $_, # sigh, overloading
151 },
152 } shift->get_all_methods(@_);
153}
154
155sub compute_all_applicable_attributes {
156 Class::MOP::Deprecated::deprecated(
157 'The compute_all_applicable_attributes method has been deprecated.'
14bda293 158 . ' Use get_all_attributes instead. This method will be removed in the Moose 2.0200 release.' );
38bf2a25 159
160 shift->get_all_attributes(@_);
161}
162
163sub get_attribute_map {
164 Class::MOP::Deprecated::deprecated(
14bda293 165 'The get_attribute_map method has been deprecated. This method will be removed in the Moose 2.0200 release.');
38bf2a25 166
167 shift->_attribute_map(@_);
168}
169
170package
171 Class::MOP::Instance;
172
173sub bless_instance_structure {
174 Class::MOP::Deprecated::deprecated(
175 'The bless_instance_structure method is deprecated.'
14bda293 176 . ' This method will be removed in the Moose 2.0200 release.' );
38bf2a25 177
178 my ( $self, $instance_structure ) = @_;
179 bless $instance_structure, $self->_class_name;
180}
181
182package
183 Class::MOP::Attribute;
184
185sub process_accessors {
186 Class::MOP::Deprecated::deprecated(
187 'The process_accessors method has been made private.'
14bda293 188 . ' The public version is deprecated. This method will be removed in the Moose 2.0200 release.'
38bf2a25 189 );
190 shift->_process_accessors(@_);
191}
192
193package
194 Class::MOP::Method::Accessor;
195
196sub initialize_body {
197 Class::MOP::Deprecated::deprecated(
198 'The initialize_body method has been made private.'
14bda293 199 . ' The public version is deprecated. This method will be removed in the Moose 2.0200 release.'
38bf2a25 200 );
201 shift->_initialize_body;
202}
203
204sub generate_accessor_method {
205 Class::MOP::Deprecated::deprecated(
206 'The generate_accessor_method method has been made private.'
14bda293 207 . ' The public version is deprecated. This method will be removed in the Moose 2.0200 release.'
38bf2a25 208 );
209 shift->_generate_accessor_method;
210}
211
212sub generate_reader_method {
213 Class::MOP::Deprecated::deprecated(
214 'The generate_reader_method method has been made private.'
14bda293 215 . ' The public version is deprecated. This method will be removed in the Moose 2.0200 release.'
38bf2a25 216 );
217 shift->_generate_reader_method;
218}
219
220sub generate_writer_method {
221 Class::MOP::Deprecated::deprecated(
222 'The generate_writer_method method has been made private.'
14bda293 223 . ' The public version is deprecated. This method will be removed in the Moose 2.0200 release.'
38bf2a25 224 );
225 shift->_generate_writer_method;
226}
227
228sub generate_predicate_method {
229 Class::MOP::Deprecated::deprecated(
230 'The generate_predicate_method method has been made private.'
14bda293 231 . ' The public version is deprecated. This method will be removed in the Moose 2.0200 release.'
38bf2a25 232 );
233 shift->_generate_predicate_method;
234}
235
236sub generate_clearer_method {
237 Class::MOP::Deprecated::deprecated(
238 'The generate_clearer_method method has been made private.'
14bda293 239 . ' The public version is deprecated. This method will be removed in the Moose 2.0200 release.'
38bf2a25 240 );
241 shift->_generate_clearer_method;
242}
243
244sub generate_accessor_method_inline {
245 Class::MOP::Deprecated::deprecated(
246 'The generate_accessor_method_inline method has been made private.'
14bda293 247 . ' The public version is deprecated. This method will be removed in the Moose 2.0200 release.'
38bf2a25 248 );
249 shift->_generate_accessor_method_inline;
250}
251
252sub generate_reader_method_inline {
253 Class::MOP::Deprecated::deprecated(
254 'The generate_reader_method_inline method has been made private.'
14bda293 255 . ' The public version is deprecated. This method will be removed in the Moose 2.0200 release.'
38bf2a25 256 );
257 shift->_generate_reader_method_inline;
258}
259
260sub generate_writer_method_inline {
261 Class::MOP::Deprecated::deprecated(
262 'The generate_writer_method_inline method has been made private.'
14bda293 263 . ' The public version is deprecated. This method will be removed in the Moose 2.0200 release.'
38bf2a25 264 );
265 shift->_generate_writer_method_inline;
266}
267
268sub generate_predicate_method_inline {
269 Class::MOP::Deprecated::deprecated(
270 'The generate_predicate_method_inline method has been made private.'
14bda293 271 . ' The public version is deprecated. This method will be removed in the Moose 2.0200 release.'
38bf2a25 272 );
273 shift->_generate_predicate_method_inline;
274}
275
276sub generate_clearer_method_inline {
277 Class::MOP::Deprecated::deprecated(
278 'The generate_clearer_method_inline method has been made private.'
14bda293 279 . ' The public version is deprecated. This method will be removed in the Moose 2.0200 release.'
38bf2a25 280 );
281 shift->_generate_clearer_method_inline;
282}
283
284package
285 Class::MOP::Method::Constructor;
286
287sub meta_instance {
288 Class::MOP::Deprecated::deprecated(
289 'The meta_instance method has been made private.'
14bda293 290 . ' The public version is deprecated. This method will be removed in the Moose 2.0200 release.'
38bf2a25 291 );
292 shift->_meta_instance;
293}
294
295sub attributes {
296 Class::MOP::Deprecated::deprecated(
297 'The attributes method has been made private.'
14bda293 298 . ' The public version is deprecated. This method will be removed in the Moose 2.0200 release.'
38bf2a25 299 );
300
301 return shift->_attributes;
302}
303
304sub initialize_body {
305 Class::MOP::Deprecated::deprecated(
306 'The initialize_body method has been made private.'
14bda293 307 . ' The public version is deprecated. This method will be removed in the Moose 2.0200 release.'
38bf2a25 308 );
309 shift->_initialize_body;
310}
311
312sub generate_constructor_method {
313 Class::MOP::Deprecated::deprecated(
314 'The generate_constructor_method method has been made private.'
14bda293 315 . ' The public version is deprecated. This method will be removed in the Moose 2.0200 release.'
38bf2a25 316 );
317 shift->_generate_constructor_method;
318}
319
320sub generate_constructor_method_inline {
321 Class::MOP::Deprecated::deprecated(
322 'The generate_constructor_method_inline method has been made private.'
14bda293 323 . ' The public version is deprecated. This method will be removed in the Moose 2.0200 release.'
38bf2a25 324 );
325 shift->_generate_constructor_method_inline;
326}
327
3281;
329
330__END__
331
332=pod
333
334=head1 NAME
335
336Class::MOP::Deprecated - Manages deprecation warnings for Class::MOP
337
338=head1 DESCRIPTION
339
340 use Class::MOP::Deprecated -api_version => $version;
341
342=head1 FUNCTIONS
343
344This module manages deprecation warnings for features that have been
345deprecated in Class::MOP.
346
347If you specify C<< -api_version => $version >>, you can use deprecated features
348without warnings. Note that this special treatment is limited to the package
349that loads C<Class::MOP::Deprecated>.
350
351=cut