/usr/share/perl5/Modern/Perl.pm is in libmodern-perl-perl 1.20150127-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 | package Modern::Perl;
# ABSTRACT: enable all of the features of Modern Perl with one import
$Modern::Perl::VERSION = '1.20150127';
use 5.010_000;
use strict;
use warnings;
use mro ();
use feature ();
# enable methods on filehandles; unnecessary when 5.14 autoloads them
use IO::File ();
use IO::Handle ();
our $VERSION;
my $wanted_date;
sub VERSION
{
my ($self, $version) = @_;
return $VERSION unless defined $version;
return $VERSION if $version < 2009;
$wanted_date = $version if (caller(1))[3] =~ /::BEGIN/;
return 2014;
}
sub import
{
my ($class, $date) = @_;
$date = $wanted_date unless defined $date;
my $feature_tag = validate_date( $date );
undef $wanted_date;
warnings->import;
strict->import;
feature->import( $feature_tag );
mro::set_mro( scalar caller(), 'c3' );
}
sub unimport
{
warnings->unimport;
strict->unimport;
feature->unimport;
}
my %dates =
(
2009 => ':5.10',
2010 => ':5.10',
2011 => ':5.12',
2012 => ':5.14',
2013 => ':5.16',
2014 => ':5.18',
2015 => ':5.20',
);
sub validate_date
{
my $date = shift;
# always enable unicode_strings when available
unless ($date)
{
return ':5.12' if $] > 5.011003;
return ':5.10';
}
my $year = substr $date, 0, 4;
return $dates{$year} if exists $dates{$year};
die "Unknown date '$date' requested\n";
}
1;
__END__
=pod
=encoding UTF-8
=head1 NAME
Modern::Perl - enable all of the features of Modern Perl with one import
=head1 VERSION
version 1.20150127
=head1 SYNOPSIS
Modern Perl programs use several modules to enable additional features of Perl
and of the CPAN. Instead of copying and pasting all of these C<use> lines,
instead write only one:
use Modern::Perl;
This enables the L<strict> and L<warnings> pragmas, as well as all of the
features available in Perl 5.10. It also enables C3 method resolution order as
documented in C<perldoc mro> and loads L<IO::File> and L<IO::Handle> so that
you may call methods on filehandles. In the future, it may include additional
core modules and pragmas.
Because so much of this module's behavior uses lexically scoped pragmas, you
may disable these pragmas within an inner scope with:
no Modern::Perl;
See L<http://www.modernperlbooks.com/mt/2009/01/toward-a-modernperl.html> for
more information, L<http://www.modernperlbooks.com/> for further discussion of
Modern Perl and its implications, and
L<http://onyxneon.com/books/modern_perl/index.html> for a freely-downloadable
Modern Perl tutorial.
=head2 Forward Compatibility
For forward compatibility, I recommend you specify a I<year> as the single
optional import tag. For example:
use Modern::Perl '2009';
use Modern::Perl '2010';
... both enable 5.10 features, while:
use Modern::Perl '2011';
... enables 5.12 features:
use Modern::Perl '2012';
... enables 5.14 features:
use Modern::Perl '2013';
... enables 5.16 features, and:
use Modern::Perl '2014';
... enables 5.18 features, and:
use Modern::Perl '2015';
... enables 5.20 features.
Obviously you cannot use newer features on earlier
versions. Perl will throw the appropriate exception if you try.
By mid-2014, this module will drop support for 5.10 and 5.12 and will complain
(once per process) if you use a year too old. As of January 2014, Perl 5.14 is
unsupported by the Perl 5 Porters, so please consider upgrading.
=head1 AUTHOR
chromatic, C<< <chromatic at wgz.org> >>
=head1 BUGS
None reported.
Please report any bugs or feature requests to C<bug-modern-perl at
rt.cpan.org>, or through the web interface at
L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Modern-Perl>. I will be
notified, and then you'll automatically be notified of progress on your bug as
I make changes.
=head1 SUPPORT
You can find documentation for this module with the perldoc command.
perldoc Modern::Perl
You can also look for information at:
=over 4
=item * RT: CPAN's request tracker
L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Modern-Perl>
=item * AnnoCPAN: Annotated CPAN documentation
L<http://annocpan.org/dist/Modern-Perl>
=item * CPAN Ratings
L<http://cpanratings.perl.org/d/Modern-Perl>
=item * Search CPAN
L<http://search.cpan.org/dist/Modern-Perl/>
=back
=head1 ACKNOWLEDGEMENTS
Damian Conway (inspiration from L<Toolkit>), Florian Ragwitz
(L<B::Hooks::Parser>, so I didn't have to write it myself), chocolateboy (for
suggesting that I don't even need L<B::Hooks::Parser>), Damien Learns Perl,
David Moreno, Evan Carroll, Elliot Shank, Andreas König, Father Chrysostomos,
and Norbert E. Grüner for reporting bugs, filing patches, and requesting
features.
=head1 COPYRIGHT & LICENSE
Copyright 2009-2014 chromatic, all rights reserved.
This program is free software; you can redistribute it and/or modify it
under the same terms as Perl 5.18 itself.
=head1 AUTHOR
chromatic
=head1 COPYRIGHT AND LICENSE
This software is copyright (c) 2015 by chromatic@wgz.org.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
=cut
|