Modern::Perl(3)

๐Ÿ’– Modern::Perl ๐Ÿ’–

okay bestie, welcome to the Modern::Perl manual page, no cap. this is the whole vibe, let's go ๐Ÿฆ‹


โœจ NAME โœจ

Modern::Perl โ€” it turns on every single feature of Modern Perl with just one import. one. that's it. periodt. ๐Ÿ’…


๐ŸŒธ VERSION ๐ŸŒธ

version 1.20250607


๐ŸŽ€ SYNOPSIS ๐ŸŽ€

okay so real talk: Modern Perl programs use several modules to enable extra features of Perl and of the CPAN. and instead of copying and pasting all of those use lines like some kind of gremlin ๐Ÿ™ˆ, you literally just write one:

use Modern::Perl;

that single line enables the strict and warnings pragmas, plus all of the features available in Perl 5.10. it also enables C3 method resolution order (as documented in perldoc mro) and loads IO::File and IO::Handle so that you may call methods on filehandles. and in the future it may include additional core modules and pragmas (but it's unlikely to include non-core features). iykyk โœจ

and 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;

if you want more info, see <http://www.modernperlbooks.com/mt/2009/01/toward-a-modernperl.html>, and for further discussion of Modern Perl and its implications see <http://www.modernperlbooks.com/>, and for a freely-downloadable Modern Perl tutorial see <http://onyxneon.com/books/modern_perl/index.html>. go read, bestie ๐Ÿ“š๐Ÿ’œ

๐Ÿ–ฅ๏ธ CLI Usage ๐Ÿ–ฅ๏ธ

as of Modern::Perl 2019, you may also enable this pragma from the command line:

$ perl -Modern::Perl -e 'say "Take that, awk!"'

you may also enable year-specific features:

$ perl -Modern::Perl=2020 -e 'say "Looking forward to Perl 5.30!"'

ate. ๐Ÿ’…

๐Ÿงš Wrapping Modern::Perl ๐Ÿงš

if you want to wrap Modern::Perl in your own import() method, you can do so to add additional pragmas or features, such as the use of Try::Tiny. but heads up bestie ๐Ÿซถ: please note that, if you do so, you will not automatically enable C3 method resolution in the calling scope. this is due to how the mro pragma works. in your custom import() method, you will need to write code such as:

mro::set_mro( scalar caller(), 'c3' );

๐Ÿ”ฎ Forward Compatibility ๐Ÿ”ฎ

for forward compatibility, the author recommends you specify a string containing a year value 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, and:

use Modern::Perl '2016';

... enables 5.24 features, and:

use Modern::Perl '2017';

... enables 5.24 features, and:

use Modern::Perl '2018';

... enables 5.26 features, and:

use Modern::Perl '2019';

... enables 5.28 features, and:

use Modern::Perl '2020';

... enables 5.30 features, and:

use Modern::Perl '2021';

... enables 5.32 features, and:

use Modern::Perl '2022';

... enables 5.34 features, and:

use Modern::Perl '2023';

... enables 5.36 features, and:

use Modern::Perl '2024';

... enables 5.38 features, and:

use Modern::Perl '2025';

... enables 5.40 features.

obviously you cannot use newer features on earlier versions. Perl will throw the appropriate exception if you try. ๐Ÿ˜ญ (so don't try. respectfully.)

as of Perl 5.38, you may prefer to write use v5.38, which is almost entirely equivalent to the use of this module. for the purpose of forward compatibility, this module will continue to work as expected โ€” and will continue regular maintenance. iconic behavior honestly ๐Ÿ‘‘

as of Perl 5.41.4, given is no longer available, so any import tags for older versions of Perl will not enable this feature, no matter how much you try. and bestie, you can try. it will not work. ๐Ÿ’€


๐Ÿ’œ AUTHOR ๐Ÿ’œ

chromatic, "<chromatic at wgz.org>"


๐Ÿ› BUGS ๐Ÿ›

none known. slay. โœจ

please report any bugs or feature requests to "bug-modern-perl at rt.cpan.org", or through the web interface at <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Modern-Perl>. the author will be notified, and then you'll automatically be notified of progress on your bug as changes are made. teamwork fr fr ๐Ÿซถ


๐Ÿซถ SUPPORT ๐Ÿซถ

you can find documentation for this module with the perldoc command.

perldoc Modern::Perl

you can also look for information at:


๐ŸŒˆ ACKNOWLEDGEMENTS ๐ŸŒˆ

shoutout to Damian Conway (inspiration from Toolkit), Florian Ragwitz (B::Hooks::Parser, so the author didn't have to write it personally), chocolateboy (for suggesting that B::Hooks::Parser isn't even needed), Damien Learns Perl, David Moreno, Evan Carroll, Elliot Shank, Andreas Kรถnig, Father Chrysostomos, Gryphon Shafer, Norbert E. Grรผner, and Slaven Rezic for reporting bugs, filing patches, and requesting features. absolute legends, every one of them ๐Ÿ’–๐ŸŒŸ


๐Ÿ‘‘ AUTHOR ๐Ÿ‘‘

chromatic


this software is copyright (c) 2025 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. free as in freedom, bestie ๐Ÿฆ‹


and that's the whole page!! ๐Ÿ’… this was perl v5.42.0, dated 2025-07-25, and the manual is Modern::Perl(3) โ€” go forth and use Modern::Perl; responsibly, mwah ๐ŸŽ€โœจ๐Ÿ’–

๐Ÿ“ฆ where this page comes from