Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Contact Us
Online Help
Domain Status
Man Pages

Virtual Servers

Topology Map

Server Agreement
Year 2038

USA Flag



Man Pages
Modern::Perl(3) User Contributed Perl Documentation Modern::Perl(3)

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

version 1.20181021

Modern Perl programs use several modules to enable additional features of Perl and of the CPAN. Instead of copying and pasting all of these "use" lines, instead write only one:
    use Modern::Perl;
This enables the strict and warnings pragmas, as well as 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. In the future, it may include additional core modules and pragmas (but is unlikely to include non-core features).
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 <> for more information, <> for further discussion of Modern Perl and its implications, and <> for a freely-downloadable Modern Perl tutorial.

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. 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' );

For forward compatibility, I recommend 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.
Obviously you cannot use newer features on earlier versions. Perl will throw the appropriate exception if you try.

chromatic, "<chromatic at>"

None reported.
Please report any bugs or feature requests to "bug-modern-perl at", or through the web interface at <>. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

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
AnnoCPAN: Annotated CPAN documentation
CPAN Ratings
Search CPAN

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


This software is copyright (c) 2018 by
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
2018-10-21 perl v5.28.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.