Perl Changes, packaging & CPAN Marcela Malov February 2011 - - PowerPoint PPT Presentation

perl
SMART_READER_LITE
LIVE PREVIEW

Perl Changes, packaging & CPAN Marcela Malov February 2011 - - PowerPoint PPT Presentation

Perl Changes, packaging & CPAN Marcela Malov February 2011 Creative Commons Summary problems & changes packaging CPAN tools Perl road-map Perl in Fedora Problems & changes Problems Motto: We suck


slide-1
SLIDE 1

Perl

Changes, packaging & CPAN Marcela Mašláňová

February 2011

Creative Commons

slide-2
SLIDE 2

Summary

· problems & changes · packaging · CPAN tools · Perl road-map

slide-3
SLIDE 3

Problems & changes

Perl in Fedora

slide-4
SLIDE 4

Problems

· Motto: “We suck at marketing.” · developers prefer different languages

· TMTOWTDI · missing applications · hard to maintain · beginners don't like command-line & vim/emacs editors

· employers can't find Perl developers

slide-5
SLIDE 5

Changes

· new design of web-pages · Perl booth/talk on every conference

· good practices · modern Perl programming

· lot of new modules · Ironman/woman contest

· http://www.enlightenedperl.org/ironman.html

· PerlIDE

· Padre, Kephra, Perlipse, vim-perl-support

slide-6
SLIDE 6

Changes

· good practices

· http://www.blip.tv/file/4697401/ · http://www.slideshare.net/kaokun/readable-perl

slide-7
SLIDE 7

Best practices

use strict; # all variables must be declare with my or

  • wn

use warnings; # warn you about uninitialized variables

slide-8
SLIDE 8

Best practices

#!/usr/bin/perl

  • pen my $file, "<",

'./a' or die $!; close $file or die $!; #!/usr/bin/perl use autodie;

  • pen my $file, "<",

'./a'; close $file;

slide-9
SLIDE 9

Best practices

use feature ':5.10'; say "Hello!"; # or use feature 'say'; say "Hello!";

slide-10
SLIDE 10

Best practices

use autodie;

  • pen my $file, '<',

'./file.txt'; close $file;

  • pen(FILE,"<","./a");

close FILE; perlcritic --brutal|--gentle somescript.pl

slide-11
SLIDE 11

Best practices

if ($value) { print “ok”; } { print “ok” } if ($value); perlcritic --brutal|--gentle somescript.pl

slide-12
SLIDE 12

Best practices

use Perl::Tidy;

  • r

perltidy somescript.pl example of setting by author of module http://settingPerl::Tidy

slide-13
SLIDE 13

Changes

· Modern Perl

· chromatic's module, book, blog

· http://www.onyxneon.com/books/modern_perl

slide-14
SLIDE 14

Modern::Perl

use Modern::Perl; # enables strict and warnings pragmas # features available in Perl 5.10 # in future – useful CPAN modules http://search.cpan.org/Modern-Perl

slide-15
SLIDE 15

Changes

· Mo[ou]se

· http://search.cpan.org/dist/Moose/lib/Moose.pm · postmodern object system for Perl 5 · Moose -> Mouse

slide-16
SLIDE 16

Changes

· webservers & framework

· ideas from Rack (Ruby) & WSGI (Python) · Perl Web Server Gateway Interface – PSGI

· Miyagawa · Plack – glue for frameworks & servers · frameworks – Catalyst, Jifty, Dancer

· http://www.slideshare.net/miyagawa/plack

· many packages -> RPM

slide-17
SLIDE 17

Packaging

Perl in Fedora

slide-18
SLIDE 18

Packaging - cpanspec

· interesting projects · https://fedoraproject.org/wiki/Perl_Wishlist · cpanspec · rules/guidelines:

· https://fedoraproject.org/wiki/Packaging/Perl · http://fedoraproject.org/wiki/Perl/updates · %{?perl_default_filter} & RPM4.9

slide-19
SLIDE 19

Packaging - filter

%prep %setup -q -n CGI.pm-%{version} %{?filter_setup: %filter_from_provides /^perl(Fh)$/d %filter_from_provides /^perl(utf8)$/d %filter_setup }

slide-20
SLIDE 20

CPAN tools

Perl in Fedora

slide-21
SLIDE 21

CPAN

· CPAN – classical tool

· query, download and build Perl modules from CPAN sites

· CPANPLUS

· API & CLI access to the CPAN mirrors

slide-22
SLIDE 22

CPAN – tools

· cpanm – App::cpanminus

· zero dependencies 5.8.x and higher · quite output · no indexing, no interactive shell · http://www.slideshare.net/miyagawa/cpanminus

slide-23
SLIDE 23

cpanm

[root@localhost ~]# cpanm Module::Build Fetching http://search.cpan.org/CPAN/authors/id/D/DA/DAG OLDEN/Module-Build-0.3624.tar.gz ... OK ==> Found dependencies: Module::Metadata, version, Perl::OST ype Fetching http://search.cpan.org/CPAN/authors/id/D/DA/DAG OLDEN/Module-Metadata-1.000004.tar.gz ... OK Configuring Module-Metadata-1.000004 ... OK ==> Found dependencies: version

slide-24
SLIDE 24

Perl tests

· testing is boring -> let's make it easy · Perl has test on everything

slide-25
SLIDE 25

T est::More

use T est::More tests => 1; BEGIN { use_ok( 'CGI' ); }

slide-26
SLIDE 26

T est::More

Various ways to say "ok":

  • k($got eq $expected, $test_name);

is ($got, $expected, $test_name); isnt($got, $expected, $test_name); http://search.cpan.org/T est/More.pm

slide-27
SLIDE 27

Cpantesters

· http://cpantesters.org/ · http://wiki.cpantesters.org/wiki/QuickStart · matrix:

· http://search.cpan.org/Salesforce-0.57/ · http://search.cpan.org/WWW-Salesforce-0.2/

slide-28
SLIDE 28

Perl road-map

Perl in Fedora

slide-29
SLIDE 29

Perl road-map

· Fedora – perl-5.12.3 · even/odd(development) releases · minor updates are just bugfix releases with minimum of changes · every spring new major release

slide-30
SLIDE 30

More for reading

· http://blogs.perl.org/ · http://ironman.enlightenedperl.org/ · http://www.modernperlbooks.com/mt/index.html · http://oreilly.com/catalog/9780596527242/ · http://oreilly.com/catalog/9780596520106/