- PROCEDURAL CODE
- LICENSE AND COPYRIGHT
nextgen - enable all of the features of next-generation perl 5 with one command
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:
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
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 oose.pm if the program is run via
perl -e, or
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)
<me at evancarroll.com>
Please report any bugs or feature requests to
bug-nextgen at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=nextgen. 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.
You can also look for information at:
RT: CPAN's request tracker
AnnoCPAN: Annotated CPAN documentation
<chromatic at wgz.org>
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 http://dev.perl.org/licenses/ for more information.