1Modern::Perl(3)       User Contributed Perl Documentation      Modern::Perl(3)
2
3
4

NAME

6       Modern::Perl - enable all of the features of Modern Perl with one
7       import
8

VERSION

10       version 1.20181021
11

SYNOPSIS

13       Modern Perl programs use several modules to enable additional features
14       of Perl and of the CPAN.  Instead of copying and pasting all of these
15       "use" lines, instead write only one:
16
17           use Modern::Perl;
18
19       This enables the strict and warnings pragmas, as well as all of the
20       features available in Perl 5.10. It also enables C3 method resolution
21       order as documented in "perldoc mro" and loads IO::File and IO::Handle
22       so that you may call methods on filehandles. In the future, it may
23       include additional core modules and pragmas (but is unlikely to include
24       non-core features).
25
26       Because so much of this module's behavior uses lexically scoped
27       pragmas, you may disable these pragmas within an inner scope with:
28
29           no Modern::Perl;
30
31       See
32       <http://www.modernperlbooks.com/mt/2009/01/toward-a-modernperl.html>
33       for more information, <http://www.modernperlbooks.com/> for further
34       discussion of Modern Perl and its implications, and
35       <http://onyxneon.com/books/modern_perl/index.html> for a freely-
36       downloadable Modern Perl tutorial.
37
38   Wrapping Modern::Perl
39       If you want to wrap Modern::Perl in your own "import()" method, you can
40       do so to add additional pragmas or features, such as the use of
41       Try::Tiny. Please note that, if you do so, you will not automatically
42       enable C3 method resolution in the calling scope. This is due to how
43       the mro pragma works. In your custom "import()" method, you will need
44       to write code such as:
45
46           mro::set_mro( scalar caller(), 'c3' );
47
48   Forward Compatibility
49       For forward compatibility, I recommend you specify a string containing
50       a year value as the single optional import tag. For example:
51
52           use Modern::Perl '2009';
53           use Modern::Perl '2010';
54
55       ... both enable 5.10 features, while:
56
57           use Modern::Perl '2011';
58
59       ... enables 5.12 features:
60
61           use Modern::Perl '2012';
62
63       ... enables 5.14 features:
64
65           use Modern::Perl '2013';
66
67       ... enables 5.16 features, and:
68
69           use Modern::Perl '2014';
70
71       ... enables 5.18 features, and:
72
73           use Modern::Perl '2015';
74
75       ... enables 5.20 features, and:
76
77           use Modern::Perl '2016';
78
79       ... enables 5.24 features, and:
80
81           use Modern::Perl '2017';
82
83       ... enables 5.24 features, and:
84
85           use Modern::Perl '2018';
86
87       ... enables 5.26 features.
88
89       Obviously you cannot use newer features on earlier versions. Perl will
90       throw the appropriate exception if you try.
91

AUTHOR

93       chromatic, "<chromatic at wgz.org>"
94

BUGS

96       None reported.
97
98       Please report any bugs or feature requests to "bug-modern-perl at
99       rt.cpan.org", or through the web interface at
100       <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Modern-Perl>.  I will
101       be notified, and then you'll automatically be notified of progress on
102       your bug as I make changes.
103

SUPPORT

105       You can find documentation for this module with the perldoc command.
106
107           perldoc Modern::Perl
108
109       You can also look for information at:
110
111       ·   RT: CPAN's request tracker
112
113           <http://rt.cpan.org/NoAuth/Bugs.html?Dist=Modern-Perl>
114
115       ·   AnnoCPAN: Annotated CPAN documentation
116
117           <http://annocpan.org/dist/Modern-Perl>
118
119       ·   CPAN Ratings
120
121           <http://cpanratings.perl.org/d/Modern-Perl>
122
123       ·   Search CPAN
124
125           <http://search.cpan.org/dist/Modern-Perl/>
126

ACKNOWLEDGEMENTS

128       Damian Conway (inspiration from Toolkit), Florian Ragwitz
129       (B::Hooks::Parser, so I didn't have to write it myself), chocolateboy
130       (for suggesting that I don't even need B::Hooks::Parser), Damien Learns
131       Perl, David Moreno, Evan Carroll, Elliot Shank, Andreas König, Father
132       Chrysostomos, Gryphon Shafer, and Norbert E. Grüner for reporting bugs,
133       filing patches, and requesting features.
134

AUTHOR

136       chromatic
137
139       This software is copyright (c) 2018 by chromatic@wgz.org.
140
141       This is free software; you can redistribute it and/or modify it under
142       the same terms as the Perl 5 programming language system itself.
143
144
145
146perl v5.28.1                      2018-10-21                   Modern::Perl(3)
Impressum