Permalink
Browse files

Fixed VERSION(undef) (Peter Vereshagin, RT #80304).

  • Loading branch information...
chromatic committed Nov 3, 2012
1 parent d0b7240 commit 7d4441e14361113bef92be29b8b323673d710f18
Showing with 17 additions and 1 deletion.
  1. +1 −0 Changes
  2. +3 −1 lib/Modern/Perl.pm
  3. +13 −0 t/regressions.t
View
@@ -1,6 +1,7 @@
Revision history for Modern::Perl
{{$NEXT}}
+ - fixed VERSION( undef ) (Peter Vereshagin, RT #80304)
- fixed POD encoding error (Norbert E. Grüner, RT #80468)
1.20120521 2012-05-21 15:58:59 America/Los_Angeles
View
@@ -19,7 +19,9 @@ my $wanted_date;
sub VERSION
{
my ($self, $version) = @_;
- return $VERSION if $version < 2009;
+
+ return $VERSION unless defined $version;
+ return $VERSION if $version < 2009;
$wanted_date = $version if (caller(1))[3] =~ /::BEGIN/;
return 2012;
View
@@ -78,4 +78,17 @@ eval 'state $x';
isnt $@, '', 'state feature does not leak out';
is uc "\xdf", "\xdf", 'unicode_strings feature does not leak out';
+
+# RT #80304: warning on Modern::Perl->VERSION()
+{
+ my $warning = '';
+ local $SIG{__WARN__} = sub { $warning = shift };
+ $Modern::Perl::VERSION ||= '1.20121103';
+
+ my $version = Modern::Perl->VERSION;
+ like $version, qr/1\.201\d/,
+ 'VERSION() should return version number, given no argument';
+ is $warning, '', '... without warning about undef argument';
+}
+
done_testing;

0 comments on commit 7d4441e

Please sign in to comment.