Modern Perl
-
Upload
aran-deltac -
Category
Technology
-
view
2.450 -
download
5
Transcript of Modern Perl
Modern Perl
“the world's best and most effective Perl programmers take full advantage of the CPAN to make up for missing language features, to improve their productivity, and because solving a problem once and for all and sharing it is the ultimate expression of laziness, impatience, and hubris”
- chromatic
Perl:The Foundation
CPAN:The Framework
15,000+ Modules
7,000+ Authors
~50 Uploads a Day
201 Mirrors
Massive.
Standard OO Perl:
package Person;
sub new { my ($class, %args) = @_; die(‘Name is required’) if !$args{name}; die(‘Name must be a string’) if ref $args{name}; return bless \%args, $class;}
sub hello { my ($self) = @_; print ‘Hi, my name is, ‘ . $self->{name} . “\n”;}
Modern OO Perl:
package Person;
use Moose;use MooseX::Method::Signature;
has ‘name’ => ( is => ’rw’, isa => ’Str’, required => 1,);
method hello { say ‘Hi, my name is, ‘ . $self->name();}
Modern Perl Code is
Concise
Robust
Maintainable
Agile
CPAN.
Knowing Perl
is not Syntax
Know your Tools
Know CPAN
Be Involved
The Short List
use strict;use warnings;use autodie;
List::UtilsList::MoreUtilsIO::FileIO::DirSub::NameSub::ExporterIPC::CmdDateTime
DBIx::ClassRose::DBCGI::ApplicationCatalystHTTP::EnginePOE
Test::MoreTest::ExceptionTest::DataTest::Warn
MooseMooseX::Method::SignatureMooseX::DeclareMooseX::MultiMethodsMooseX::TypesMooseX::GetoptMouse
Perl 5.10
More Reading
• http://www.modernperlbooks.com/mt/• http://www.enlightenedperl.org/• http://blog.timbunce.org/• irc.perl.org #moose, #dbix-class, #catalyst, etc