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:
- RT: CPAN's request tracker โ <http://rt.cpan.org/NoAuth/Bugs.html?Dist=Modern-Perl>
- AnnoCPAN: Annotated CPAN documentation โ <http://annocpan.org/dist/Modern-Perl>
- CPAN Ratings โ <http://cpanratings.perl.org/d/Modern-Perl>
- Search CPAN โ <http://search.cpan.org/dist/Modern-Perl/>
๐ 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
๐ COPYRIGHT AND LICENSE ๐
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
- fedora 43: perl-Modern-Perl 1.20250607-2.fc43 ยท GPL-1.0-or-later OR Artistic-1.0-Perl
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms