Skip to content

Commit

Permalink
Require Package::DeprecationManager - it plays nice with our exporting
Browse files Browse the repository at this point in the history
  • Loading branch information
autarch committed Nov 14, 2015
1 parent 0bfe49c commit 5243503
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 3 deletions.
9 changes: 9 additions & 0 deletions Changes
@@ -1,5 +1,14 @@
{{$NEXT}}

[BUG FIXES]

- If you loaded this module with warnings globally enabled ("perl -w", which
you should never do), then you'd get a warning about the import subroutine
being redefined. This broke the Package::DeprecationManager API for turning
off deprecation warnings. This has been fixed in
Package::DeprecationManager 0.15. Reported by Martin. RT #108871.


1.60 2015-11-07

- This release is identical to the prior trial release. The changes for the
Expand Down
6 changes: 3 additions & 3 deletions lib/DateTime/Format/Strptime.pm
Expand Up @@ -12,12 +12,12 @@ use DateTime::TimeZone 0.79;
use Params::Validate 1.20 qw( validate SCALAR BOOLEAN OBJECT CODEREF );
use Try::Tiny;

use Package::DeprecationManager -deprecations => {
use Exporter qw( import );

use Package::DeprecationManager 0.15 -deprecations => {
'accessor writers' => '1.58',
};

use Exporter qw( import );

our @EXPORT_OK = qw( strftime strptime );

use constant PERL_58 => $] < 5.010;
Expand Down
40 changes: 40 additions & 0 deletions t/import.t
@@ -0,0 +1,40 @@
use strict;
use warnings;

# We need this to be set to catch warning from inside other packages.
BEGIN {
$^W = 1;
}

use Test::More;
use Test::Warnings qw( warnings );

use DateTime::Format::Strptime qw( strftime strptime ),
-api_version => '1.55';

is_deeply(
[
warnings {
my $parser = DateTime::Format::Strptime->new( pattern => '%Y' );
$parser->pattern('%y');
$parser->locale('fr');
$parser->time_zone('UTC');
}
],
[],
'no warnings when calling accessors on constructed object'
);

is(
strptime( '%Y', '2005' )->year,
2005,
'export strptime works as expected'
);

is(
strftime( '%Y', DateTime->new( year => 2005 ) ),
2005,
'export strftime works as expected'
);

done_testing();

0 comments on commit 5243503

Please sign in to comment.