deploying perl 6 - pugs · 2008-10-05 · pugs 6.2.12 •released on june 26th •3x faster build...
TRANSCRIPT
![Page 1: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/1.jpg)
DeployingPerl 6
AudreyTang
1
![Page 2: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/2.jpg)
Perl6ishereToday!
2
![Page 3: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/3.jpg)
Perl6ishereToday!(YAPC::NA2005)
3
![Page 4: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/4.jpg)
Pugs6.2.12•ReleasedonJune26th
•3xfasterbuildtime
•10xfastercompilation
•2xfasterruntime
•2000+commitssince6.2.11
4
![Page 5: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/5.jpg)
Parrot0.4.5•ReleasedlastJune19th
•Unicodeidentifiers
•Hierarchicalnamespace
•New.NETCLRtranslator
•Muchfastercompilertools
5
![Page 6: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/6.jpg)
Greatforexperimenting
6
![Page 7: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/7.jpg)
Butnotforproduction
7
![Page 8: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/8.jpg)
...notthisChristmas
8
![Page 9: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/9.jpg)
9
![Page 10: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/10.jpg)
CPANisthelanguage
10
![Page 11: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/11.jpg)
Perlisjustitssyntax
11
![Page 12: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/12.jpg)
Perl5.000b3h(October1994)
12
![Page 13: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/13.jpg)
• use5.000;• usestrict;• require'fastcwd.pl';• require'newgetopt.pl';• require'exceptions.pl';• #...•
13
![Page 14: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/14.jpg)
Continuity++
14
![Page 15: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/15.jpg)
Pugs6.2.2
(June2005)
15
![Page 16: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/16.jpg)
• use v6-pugs;• use perl5:DBI;• use perl5:Encode;• use perl5:Template;• # ...•
16
![Page 17: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/17.jpg)
StillneedtoinstallPugs
17
![Page 18: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/18.jpg)
Perl5.9.3
(Jan2006)
18
![Page 19: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/19.jpg)
• usev5.9.3;• usefeatureqw(switchsayerr~~);
• given(shift()){• when['‐h','‐‐help']{• say"Usage:$0";• }• default{• $0~~'moose.exe'errdie"NotMoose";• }• }•
19
![Page 20: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/20.jpg)
HowtogetPerl6intoProduction?
20
![Page 21: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/21.jpg)
Production
• Workwithexistingcode
• MustsupportPerl5andXS
• Nofrom‐scratchrewrites
21
![Page 22: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/22.jpg)
Frontends?
Parrot
Tcl Python Scheme
22
![Page 23: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/23.jpg)
Frontends?
Parrot
Tcl Python Scheme
Perl 5(Ponie)
Perl 6
23
![Page 24: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/24.jpg)
Backends!
Pugs
HaskellJava
ScriptPerl 5
24
![Page 25: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/25.jpg)
Backends!
Pugs
JavaScript
Haskell Perl 5
YARV?JVM?
CLR? PyPy?
25
![Page 26: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/26.jpg)
PugsonPerl5
26
![Page 27: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/27.jpg)
Perl6RuntimeImplementedasPerl5Modules
27
![Page 28: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/28.jpg)
SanePerl5(notsourcefilters)
28
![Page 29: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/29.jpg)
AvailableOnCPANToday
29
![Page 30: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/30.jpg)
Moose.pm☯
30
![Page 31: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/31.jpg)
WhatisMoose?
• CompleteobjectmodelforPerl5
• BasedonthePerl6objectmodel
• ProductionReady
31
![Page 32: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/32.jpg)
Moose,it’sthenewCamel
32
![Page 33: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/33.jpg)
ObjectsWithClass
33
![Page 34: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/34.jpg)
• usev6‐pugs;• classPoint;• • • has$.xisrw;#instanceattributes• has$.y;#default"isreadonly"• • methodclear(){
• $.x=0;#accessor• $!y=0;#directslotaccess• }•
34
![Page 35: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/35.jpg)
• usev5;• packagePoint;• useMoose;• • hasx=>(is=>'rw');• hasy=>(is=>'ro');• • subclear{• my$self=shift;• $self‐>x(0);#accessor• $self‐>{y}=0;#directslotaccess• }•
35
![Page 36: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/36.jpg)
Subclassing
36
![Page 37: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/37.jpg)
• usev6‐pugs;• classPoint3D;• • • isPoint;• • has$.z;• • methodclear(){• • call;• $!z=0;• };•
37
![Page 38: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/38.jpg)
• usev5;• packagePoint3D;• useMoose;• • extends'Point';• • hasz=>(isa=>'Int');• • overrideclear=>sub{• my$self=shift;• super;• $self‐>{z}=0;• };•
38
![Page 39: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/39.jpg)
• usev5;• packagePoint3D;• useMoose;• • extends'Point';• • hasz=>(isa=>'Int');• • afterclear=>sub{• my$self=shift;• • $self‐>{z}=0;• };•
39
![Page 40: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/40.jpg)
MetaObjects
40
![Page 41: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/41.jpg)
• usev6‐pugs;
• Foo.meta.add_method(bar=>method{• say"HellofromFoo.bar";• });• Foo.meta.superclasses;• Foo.meta.compute_all_applicable_methods;• Foo.meta.find_all_methods_by_name($method_name);
•
41
![Page 42: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/42.jpg)
• usev5;• useMoose;• Foo‐>meta‐>add_method(bar=>sub{• print"HellofromFoo‐>bar\n";• });• Foo‐>meta‐>superclasses;• Foo‐>meta‐>compute_all_applicable_methods;• Foo‐>meta‐>find_all_methods_by_name($method_name);
•
42
![Page 43: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/43.jpg)
Laziness
43
![Page 44: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/44.jpg)
• usev6‐pugs;• classBinaryTreeisrw;• • hasAny$.node;• hasBinaryTree$.parenthandles{• parent_node=>'node'• };• hasBinaryTree$.left={• lazy{BinaryTree.new(parent=>self)}• };• hasBinaryTree$.right={• lazy{BinaryTree.new(parent=>self)}• };•
44
![Page 45: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/45.jpg)
• usev5;• packageBinaryTree;• useMoose;• • hasnode=>(is=>'rw',isa=>'Any');• hasparent=>(• is=>'rw',• isa=>'BinaryTree',• handles=>{parent_node=>'node'},• weak_ref=>1,• );• hasleft=>(• is=>'rw',• isa=>'BinaryTree',• default=>sub{BinaryTree‐>new(parent=>$_[0])},• lazy=>1,• );
• #dittofor“hasright”
45
![Page 46: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/46.jpg)
TypeConstraints
46
![Page 47: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/47.jpg)
• usev6‐pugs;• classAddress;• useperl5:Locale::US;• useperl5:Regexp::Common<zip$RE>;• • my$STATES=Locale::US.new;• subsetUS_StateofStrwhere{• $STATES{any(<code2statestate2code>)}{.uc};• };• • hasStr$.streetisrw;• hasStr$.cityisrw;• hasUS_State$.stateisrw;• hasStr$.zip_codeisrwwhere{• $_~~$RE<zip><US>{'‐extended'=>'allow'}• };•
47
![Page 48: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/48.jpg)
• usev5;• packageAddress;• useMoose;• useMoose::Util::TypeConstraints;• useLocale::US;• useRegexp::Common'zip';• • my$STATES=Locale::US‐>new;• subtypeUSState=>asStr=>where{• $STATES‐>{code2state}{uc($_)}• or$STATES‐>{state2code}{uc($_)};• }• • hasstreet=>(is=>'rw',isa=>'Str');• hascity=>(is=>'rw',isa=>'Str');• hasstate=>(is=>'rw',isa=>'USState');• haszip_code=>(• is=>'rw',• isa=>subtypeStr=>where{• /$RE{zip}{US}{‐extended=>'allow'}/• },• );•
48
![Page 49: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/49.jpg)
Roles
49
![Page 50: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/50.jpg)
• usev6‐pugs;• roleEquality;• • methodequal_to($other){...}• • methodnot_equal_to($other){
• not$self‐>equal_to($other);• }• •
50
![Page 51: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/51.jpg)
• usev5;• packageEquality;• useMoose::Role;• requires'equal_to';• • subnot_equal_to{• my($self,$other)=@_;• not$self‐>equal_to($other);• }• •
51
![Page 52: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/52.jpg)
DerivedRoles
52
![Page 53: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/53.jpg)
• usev6‐pugs;• roleComparable;• doesEquality;• • methodcompare($other){...}
• methodequal_to($other){
• $self‐>compare($other)==0;• }• • methodgreater_than($other){
• $self‐>compare($other)==1;• }• • methodless_than($other){
• $self‐>compare($other)==‐1;• }•
53
![Page 54: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/54.jpg)
• usev5;• packageComparable;• with'Equality';• • requires'compare';• • subequal_to{• my($self,$other)=@_;• $self‐>compare($other)==0;• }• • subgreater_than{• my($self,$other)=@_;• $self‐>compare($other)==1;• }• • subless_than{• my($self,$other)=@_;• $self‐>compare($other)==‐1;• }•
54
![Page 55: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/55.jpg)
AbstractInterfaceRoles
55
![Page 56: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/56.jpg)
• usev6‐pugs;• rolePrintable;
• • methodto_string{...}
56
![Page 57: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/57.jpg)
• usev5;• packagePrintable;• useMoose::Role;• • requires'to_string';
57
![Page 58: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/58.jpg)
MixingInRoles
58
![Page 59: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/59.jpg)
• usev6‐pugs;• classPerson;• doesComparable;• doesPrintable;• • hasStr$.first_name;• hasStr$.last_name;• • methodto_string(){• • "$.last_name,$.first_name";• }• • methodcompare($other){• • $.to_stringcmp$other.to_string;• }•
59
![Page 60: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/60.jpg)
• usev5;• packagePerson;• useMoose;• with'Comparable','Printable';• • hasfirst_name=>(isa=>'Str');• haslast_name=>(isa=>'Str');• • subto_string{• my$self=shift;• $self‐>last_name.','.$self‐>first_name;• }• • subcompare{• my($self,$other)=@_;• $self‐>to_stringcmp$other‐>to_string;• }•
60
![Page 61: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/61.jpg)
•AutomaticCoercion
•AccessorTriggers
•Alternatelayouts!
Morefeatures
61
![Page 62: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/62.jpg)
Pugs::Compiler::Rule☯
62
![Page 63: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/63.jpg)
RegexObjects
63
![Page 64: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/64.jpg)
• usev6‐pugs;
• my$txt='Car‐ModelT,1909';• my$pat=rx{• Car‐• [(Ferrari)• |(ModelT,(\d\d\d\d))• ]• };• $txt~~$paterrfail"Cannotmatch";•
64
![Page 65: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/65.jpg)
• usev5;• usePugs::Compiler::Regex;• my$txt='Car‐ModelT,1909';• my$pat=Pugs::Compiler::Regex‐>compile(q(• Car‐• [(Ferrari)• |(ModelT,(\d\d\d\d))• ]• ));• $pat‐>match($txt)ordie"Cannotmatch";•
65
![Page 66: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/66.jpg)
MatchObjects
66
![Page 67: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/67.jpg)
• usev6‐pugs;
• my$pat=rx{• Car‐[• (Ferrari)|(ModelT,(\d\d\d\d))• ]• };
• my$match=('Car‐ModelT,1909'~~$pat);• say$match;#"Car‐ModelT,1909"• say$match[0];#undef• say$match[1];#"ModelT,1909"• say$match[1][0];#"1909"• say$match[1][0].from;#11• say$match[1][0].to;#15•
67
![Page 68: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/68.jpg)
• usev5;• usePugs::Compiler::Regex;• my$pat=Pugs::Compiler::Regex‐>compile(q(• Car‐[• (Ferrari)|(ModelT,(\d\d\d\d))• ]• ));
• usefeatureqw(say);• my$match=$pat‐>match('Car‐ModelT,1909');• say$match;#"Car‐ModelT,1909"• say$match‐>[0];#undef• say$match‐>[1];#"ModelT,1909"• say$match‐>[1][0];#"1909"• say$match‐>[1][0]‐>from;#11• say$match‐>[1][0]‐>to;#15•
68
![Page 69: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/69.jpg)
NamedCaptures
69
![Page 70: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/70.jpg)
• usev6‐pugs;• • my$pat=rx{• Car‐[• (Ferrari)• |(ModelT,$<year>:=[\d\d\d\d])• ]• };
• my$match=('Car‐ModelT,1909'~~$pat);• say$match;#"Car‐ModelT,1909"• say$match[1];#"ModelT,1909"• say$match[1]<year>;#"1909"• say$match[1]<year>.from;#11• say$match[1]<year>.to;#15•
70
![Page 71: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/71.jpg)
• usev5;• usePugs::Compiler::Regex;• my$pat=Pugs::Compiler::Regex‐>compile(q(• Car‐[• (Ferrari)• |(ModelT,$<year>:=[\d\d\d\d])• ]• ));
• usefeatureqw(say);• my$match=$pat‐>match('Car‐ModelT,1909');• say$match;#"Car‐ModelT,1909"• say$match‐>[1];#"ModelT,1909"• say$match‐>[1]{year};#"1909"• say$match‐>[1]{year}‐>from;#11• say$match‐>[1]{year}‐>to;#15•
71
![Page 72: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/72.jpg)
GrammarModules
72
![Page 73: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/73.jpg)
• usev6‐pugs;• • grammarCarInfo;• • regexcar{• Car‐[(Ferrari)|(ModelT,<year>)]• }• regexyear{• \d\d\d\d• }• • moduleMain;• my$match=('Car‐ModelT,1909'~~CarInfo.car);•
73
![Page 74: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/74.jpg)
• usev5;• usePugs::Compiler::Regex;• packageCarInfo;• usebase'Pugs::Grammar::Base';• *Car‐Pugs::Compiler::Regex‐>compile(q(• Car‐[(Ferrari)|(ModelT,<year>)]• ))‐>code;• *year=Pugs::Compiler::Regex‐>compile(q(• \d\d\d\d• ))‐>code;• • packagemain;• my$match=CarInfo‐>car('Car‐ModelT,1909');•
74
![Page 75: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/75.jpg)
ResultObjects
75
![Page 76: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/76.jpg)
• #XXX‐TypicalPerl5code• usev5;• my$txt='Car‐ModelT,1909';• my$pat=qr{• Car‐(?:(Ferrari)|(ModelT,(\d\d\d\d)))• }x;
• my$obj;• if($txt=~$pat){• if($1){• $obj=Car‐>new(color=>"red");• }elsif($2){• $obj=Car‐>new(color=>"black",year=>$3);• }• }•
76
![Page 77: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/77.jpg)
• usev6‐pugs;
• my$txt='Car‐ModelT,1909';• my$pat=rx{• Car‐[Ferrari• {returnCar.new(:color<red>)}• |ModelT,$<year>:=[\d\d\d\d]• {returnCar.new(:color<black>:$<year>)}• ]• };
• my$obj=$($txt~~$pat);• print$obj<year>;#1909
77
![Page 78: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/78.jpg)
• usev5;• usePugs::Compiler::Regex;• my$txt='Car‐ModelT,1909';• my$pat=Pugs::Compiler::Regex‐>compile(q(• Car‐[Ferrari• {returnCar‐>new(color=>'red')}• |ModelT,$<year>:=[\d\d\d\d]• {returnCar‐>new(• color=>'black',year=>$<year>)}• ]• ));• my$obj=$pat‐>match($txt)‐>();• print$obj‐>{year};#1909
78
![Page 79: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/79.jpg)
BacktrackControl
79
![Page 80: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/80.jpg)
• usev6‐pugs;• "ModelT2005"~~regex{• Car‐ModelT\d*;• };
• usev5;• "ModelT2005"=~qr{• Car‐ModelT\d*;• }x;
80
![Page 81: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/81.jpg)
• usev6‐pugs;• "ModelT2005"~~token{• Car‐ModelT\d*;• };
• usev5;• "ModelT2005"=~qr{• Car‐ModelT(?>\d*);• }x;
81
![Page 82: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/82.jpg)
• usev6‐pugs;• "ModelT2005"~~rule{• Car‐ModelT\d*;• };
• usev5;• "ModelT2005"=~qr{• Car\s*=\s*ModelT\s+(?>\d*)\s*;• }x;
82
![Page 83: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/83.jpg)
MoreComponents
•Pugs::Grammar::Precedence
•Pugs::Grammar::MiniPerl6
•Pugs::Compiler::RegexPerl5
83
![Page 84: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/84.jpg)
Module::Compile☯
84
![Page 85: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/85.jpg)
EveryonehatesSpiffy
85
![Page 86: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/86.jpg)
• usev5;• useSpiffy‐Base;
• mysubprivate{• "It'saprivatemethodhere";• }
• subpublic{• $self‐>$private;• }
• subnew(){• my$self=super;• $self‐>init;• return$self;• }•
86
![Page 87: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/87.jpg)
ToomuchMagic
87
![Page 88: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/88.jpg)
YAMLusedSpiffy
88
![Page 89: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/89.jpg)
Test::BaseusesSpiffy
89
![Page 90: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/90.jpg)
IO::AllusesSpiffy
90
![Page 91: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/91.jpg)
KwikiusesIO::All
91
![Page 92: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/92.jpg)
Ergo...
92
![Page 93: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/93.jpg)
EveryonehatesIngy
93
![Page 94: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/94.jpg)
What'shatefulaboutSpiffy?
94
![Page 95: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/95.jpg)
It'saSourceFilter!
95
![Page 96: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/96.jpg)
• usev5;• useFilter::Simplesub{• s{(^sub\s+\w+\s+\{)}• {$1\nmy$self=shift;\n}mgx;• }•
96
![Page 97: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/97.jpg)
•Addsdependency
•Slowsdownstartup
•Breaksperl‐d
•WrecksotherSourceFilters
Filter::SimpleBad
97
![Page 98: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/98.jpg)
Wecanfixit!
98
![Page 99: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/99.jpg)
• usev5;• useFilter::Simplesub{• s{(^sub\s+\w+\s+\{)}• {$1\nmy$self=shift;\n}mgx;• }
99
![Page 100: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/100.jpg)
• usev5;• useFilter::Simple::Compilesub{• s{(^sub\s+\w+\s+\{)}• {$1\nmy$self=shift;\n}mgx;• }
100
![Page 101: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/101.jpg)
Howdoesthatwork?
101
![Page 102: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/102.jpg)
Little‐knownfact:
102
![Page 103: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/103.jpg)
“useFoo”looksforFoo.pmcbeforeFoo.pm
103
![Page 104: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/104.jpg)
• %echo'print"Hello\n"'>Foo.pmc• %perl‐MFoo‐e1• Hello
104
![Page 105: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/105.jpg)
Saveprecompiledresultto.pmc...
105
![Page 106: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/106.jpg)
...nofilteringneedednexttime!
106
![Page 107: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/107.jpg)
•Freeofuser‐sidedependencies
•Faststartuptime
•Debuggablesourceisallin.pmc
•Allowscomposableprecompilers
Module::CompileGood
107
![Page 108: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/108.jpg)
• packageFoo;• useModule::Compile‐base;• • subpmc_compile{• my($class,$source,$context)=@_;• #Convert$sourceinto$compiled_output...• return$compiled_output;• }•
108
![Page 109: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/109.jpg)
Filter::Simple::Compile
109
![Page 110: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/110.jpg)
• #Drop‐inreplacementtoFilter::Simple• packageAcme::Y2K;• useFilter::Simple::Compilesub{• tr/y/k/;• }•
110
![Page 111: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/111.jpg)
• #It'slexical!• my$normal_code_here;• {• useAcme::Y2K;• pacyageFoo;• mydir"tmp";• }• my$normal_code_there;•
111
![Page 112: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/112.jpg)
Filter::Macro
112
![Page 113: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/113.jpg)
• packageMyHandyModules;• useFilter::Macro;
• #linesbelowwillbeexpandedintocaller'scode• usestrict;• usewarnings;• useFatalqw(openclose);• useFindBinqw($Bin);•
113
![Page 114: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/114.jpg)
• #Inyourcode• packageMyApp;• useMyHandyModules;• print"I'minvokedfrom$Bin";•
114
![Page 115: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/115.jpg)
• #Inyourcode• packageMyApp;
• usestrict;• usewarnings;• useFatalqw(openclose);• useFindBinqw($Bin);
• #line3• print"I'minvokedfrom$Bin";•
115
![Page 116: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/116.jpg)
• #Makefile.PL• useinc::Module::Install;• • name'MyApp';• all_from'lib/MyApp.pm';• • pmc_support;
• WriteAll;•
116
![Page 117: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/117.jpg)
Nodependencyon
MyHandyModules.pm
117
![Page 118: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/118.jpg)
Inline::Module
118
![Page 119: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/119.jpg)
• #Aww...• packageMyApp;• useFile::Slurpqw(slurp);• useHTTP::MessageParser;•
119
![Page 120: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/120.jpg)
• #Yay!• packageMyApp;• useInline::Module'File::Slurp'=>qw(slurp);• useInline::Module'HTTP::MessageParser';•
120
![Page 121: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/121.jpg)
ZeroDependencies
121
![Page 122: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/122.jpg)
WhataboutDeployingPerl6?
122
![Page 123: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/123.jpg)
usev6‐alpha;
123
![Page 124: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/124.jpg)
v6.pm(onCPANnow!)
124
![Page 125: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/125.jpg)
WritePerl6compiletoPerl5
125
![Page 126: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/126.jpg)
Source:Rule.pm
126
![Page 127: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/127.jpg)
• usev6‐pugs;• • grammarPugs::Grammar::Rule;• rulews:P5{• ^((?:\s|\#(?‐s:.)*)+)• }• #...morerules...
127
![Page 128: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/128.jpg)
Target:Rule.pmc
128
![Page 129: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/129.jpg)
• #Generatedbyv60(Module::Compile0.15)‐donotedit!• #line1##########(((32‐bitChecksumValidator)))##################• BEGIN{use5.006;local(*F,$/);($F=__FILE__)=~s!c$!!;open(F)• ordie"Cannotopen$F:$!";binmode(F,':crlf');unpack('%32N*',<F>)• ==0x1D6399E1ordie"Checksumfailedforoutdated.pmcfile:${F}c"}• #line1#############################################################• packagePugs::Grammar::Rule;• usebase'Pugs::Grammar::Base';• *{'Pugs::Grammar::Rule::ws'}=sub{• my$grammar=shift;• #warn"ruleargumentisundefined"unlessdefined$_[0];• $_[0]=""unlessdefined$_[0];• my$bool=$_[0]=~/^((?:\s|\#(?‐s:.)*)+)(.*)$/sx;• return{• bool=>$bool,• match=>$1,• tail=>$2,• #capture=>$1,• }• };• #...morerules...
129
![Page 130: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/130.jpg)
“CPANisthelanguage,Perl6isjustabetter
syntaxsugar!”
130
![Page 131: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/131.jpg)
Stillneedswork!
131
![Page 132: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/132.jpg)
In Progress➳
132
![Page 133: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/133.jpg)
Augmentation (XS)PadWalker, Devel::Caller
autobox, re::override ...
SemanticsData::Bind, Class::MOP
Pugs::Runtime, Pugs::Compiler::Rule ...
Perl 5 SugarMoose, Moose::Autobox ...
Syntaxv6.pm
Pugs::Compiler::Perl6 ...
Core
perl
Tool SupportCPAN, PAUSE
Perldoc, Perl::Tidy ...
!"#$%&
'()&*+,&-"#%
.&*%!/01!2.34!1"#56
InfrastructureParse::Yapp
Module::Compile ...
133
![Page 134: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/134.jpg)
NativeTypeBridgeMoose::Autobox
134
![Page 135: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/135.jpg)
BuiltinObjectsPugs::Runtime::*
135
![Page 136: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/136.jpg)
CallingConventionData::Bind
136
![Page 137: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/137.jpg)
MultiDispatchSub::Multi
137
![Page 138: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/138.jpg)
EvenMoreSugarre::override
138
![Page 139: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/139.jpg)
TranslatorsMAD➠Perl6
139
![Page 140: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/140.jpg)
Multiversioningonly.pm
140
![Page 141: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/141.jpg)
• #Theusecase• usev5;• packageFoo1;subnew{bless{},'Foo1'}• packageFoo2;subnew{bless{},'Foo2'}• packageTest1;subt1{Common‐>foo}• packageTest2;subt2{Common‐>foo}• packageCommon;subfoo{Foo‐>new}
• packagemain;• warnTest1::t1();#Foo1object• warnTest2::t2();#Foo2object
•Foo
Common
Test1 Test2
Foo1 Foo2
141
![Page 142: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/142.jpg)
• #Theimplementation• usev5;• BEGIN{$^P|=0x01}• • my%dep_map=(• Test1=>{Foo=>'Foo1'},• Test2=>{Foo=>'Foo2'},• );• • subDB::sub{• my$cls=(split(/::/,$DB::sub,2))[0];• while(my($k,$v)=each%{$dep_map{$cls}}){• %{"$k\::"}=%{"$v\::"};• }• goto&$DB::sub;• }•
142
![Page 143: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/143.jpg)
CommitsWelcome!
143
![Page 144: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/144.jpg)
WhenwillPerl6bereleased?
☾
144
![Page 145: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/145.jpg)
ByChristmas!
145
![Page 146: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/146.jpg)
WhenPerl6isout,everydaywillbelike
Christmas!❆
146
![Page 147: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/147.jpg)
TheAdventstartsNow
147
![Page 148: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/148.jpg)
148
![Page 149: Deploying Perl 6 - Pugs · 2008-10-05 · Pugs 6.2.12 •Released on June 26th •3x faster build time •10x faster compilation •2x faster runtime •2000+ commits since 6.2.11](https://reader031.vdocument.in/reader031/viewer/2022011906/5f4474ade720be5e345137e5/html5/thumbnails/149.jpg)
Thank you!☺
149