View on
Evan Carroll > nextgen > nextgen



Annotate this POD


View/Report Bugs
Module Version: 0.06   Source  


nextgen - enable all of the features of next-generation perl 5 with one command


Version 0.01


The nextgen pragma uses 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 nextgen;

But the joy doens't stop there, here are some examples of the command line.

    perl -Mnextgen -E'say Class->new->meta->name'
    # You can see warnings is on:
    perl -Mnextgen -E'(undef) + 5'
    # And, strict
    perl -Mnextgen -E'my $foo = "bar"; $$foo = 4; say $$foo'
    #   And, it wouldn't be nextgen if this was allowed.        
    perl -Mnextgen -E'use NEXT;'
    # Or, this
    perl -Mnextgen -MNEXT -e1

But the joy doesn't stop there, here are some examples in module.

    package Foo;
    ## easier than strict, warnings, indirect, autodie, mro-c3, Moose, and blacklist
    use nextgen;
    ## vanilla Moose to follow
    has "foo" => ( isa => "Str", is => "rw" )
    package main;
    use nextgen;
    ## this works
    my $o = Foo->new;
    ## this wouldn't
    ## main is understood to be mode => [qw/procedural])
    my $o = main->new

For now, this module just does

Perl assertion

asserts 5.10.1+ is loaded -- 5.10.0 is unsupported and not forwards compatable because of smart match.

strict and warnings

uses the vanilla strict, and warnings pragmas

adds Perl 5.10 features

disables indirect method syntax via indirect

throws fatal exceptions in a sane fashion for CORE functions via autodie

C3 method resolution order via mro

adds Moose if the package isn't main

uses if the program is run via perl -e, or perl -E


cleans up the class via namespace::autoclean if the module has a constructor (sub new).

In the future, nextgen will include additional CPAN modules which have proven useful and stable.

This module started out as a fork of Modern::Perl, it wasn't modern enough and the author wasn't attentive enough to the needs for a more modern perl5.


If you wish to write nextgen module that doesn't assume non-"main" packages are object-oriented classes, then use the :procedural token:

    use nextgen mode => [qw(:procedural)]

    or even

    use nextgen mode => qw(:procedural)


Evan Carroll, <me at>


Please report any bugs or feature requests to bug-nextgen 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 nextgen

You can also look for information at:


Original Modern::Perl author

chromatic, <chromatic at>

RT Bug report submitters



Copyright 2010 and into the far and distant future, Evan Carroll.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See for more information.

syntax highlighting: