10 eval 'package Foo; use Package::DeprecationManager;';
13 qr/^\QYou must provide a hash reference -deprecations parameter when importing Package::DeprecationManager/,
14 'must provide a set of deprecations when using Package::DeprecationManager';
20 use Package::DeprecationManager -deprecations => {
27 deprecated('foo is deprecated');
31 deprecated('bar is deprecated');
44 ::warning_is{ Foo::foo() }
45 { carped => 'foo is deprecated' },
46 'deprecation warning for foo';
48 ::warning_is{ Foo::bar() }
49 { carped => 'bar is deprecated' },
50 'deprecation warning for bar';
52 ::warning_is{ Foo::baz() }
53 { carped => 'Foo::baz has been deprecated since version 1.21' },
54 'deprecation warning for baz, and message is generated by Package::DeprecationManager';
56 ::warning_is{ Foo::foo() } q{}, 'no warning on second call to foo';
58 ::warning_is{ Foo::bar() } q{}, 'no warning on second call to bar';
60 ::warning_is{ Foo::baz() } q{}, 'no warning on second call to baz';
66 Foo->import( -api_version => '0.01' );
68 ::warning_is{ Foo::foo() }
70 'no warning for foo with api_version = 0.01';
72 ::warning_is{ Foo::bar() }
74 'no warning for bar with api_version = 0.01';
76 ::warning_is{ Foo::baz() }
78 'no warning for baz with api_version = 0.01';
85 Foo->import( -api_version => '1.17' );
87 ::warning_is{ Foo::foo() }
88 { carped => 'foo is deprecated' },
89 'deprecation warning for foo with api_version = 1.17';
91 ::warning_is{ Foo::bar() }
92 { carped => 'bar is deprecated' },
93 'deprecation warning for bar with api_version = 1.17';
95 ::warning_is{ Foo::baz() }
97 'no warning for baz with api_version = 1.17';