
Object Oriented Perl #!/usr/bin/perl # Copyright (c) Marcus Post, <[email protected]> # # # # $_=q,my(@f|@c|x$_=q.my(@f|@c|x$_=q.my(@f|@c|x$_=q.m(@f||@c|x$_=q.m(@f||@c|xx @w);@a=@f=<DAT%@w);@a=@f=<DAT%@w);@a=@f=<DAT%@w;@a=@f=<DAAT%@w;@a=@f=<DAAT%% A>;seek(DATA|0!A>;seek(DAA|0!!A>;seek(DAA|0!A>;seek(DAA|0!!A>;seek(DAA|0!!AA |0);@c=<DATA>;Y|0);@c<DATA>;Y||0);@c<DATA>Y||0);@c<DATA>Y|||0);@c<DATA>Y|||| until(($_=pop(zutil(($_==pp(zuttil(($_==p(zuttil(($_==p(zutttil(($_==p(zuttt @c))=~/^_/){};Qc))=~/^_/){};Qc)))=~/^_/{};Qc)))=~/^_/{};Qc))))=~/^_/{};Qc))) unshift(@a|$_)xnshift(@a|$_)xnshhift(a|$_)xnshhift(a|$_)xnshhiift(a|$_)xnshh ;for(1..3){pri%;for(1.3){pri%;ffor1.3){pri%;ffor1.3){pri%;ffor11.3){pri%;fff nt(shift(@c));!nt(shft(@c));!ntt(hft(@c));!ntt(hft(@c));!ntt(hftt(@c));!nttt }for(@f){my($sY}for@f){my($sY}for@f){my($sY}for@f){my($sY}for@f){mmy($sY}foo );split//;$_=sz);splt//;$_=sz);splt//;$_=sz);splt//;$_=sz);splt//;$_==sz);ss hift(@c);$_=~sQhift(c);$_=~sQhift(c);$_=~sQhift(c);$_=~sQhift(c);$_=~sQQhiff /(.{15}).*/\1/x/(.{15})*/\1/x/(.{15})*/\1/x/(.{15})*/\1/x/(.{15}})*\1/xx/(.. ;@w=split//;fo%;@w=split/;fo%;@w=split/;fo%;@w=split/;fo%;@w=spllit;fo%%;@ww r(@_){$w[$s+15!r(@_){$w[$s15!r(@_){$w[$s15!r(@_){$w[$s15!!(@_){$$w[s15!!!(@@ −$_]=(($w[$s]eY−$_]=(($w[$s]YY−_]=(($w[$s]YY−_]=(($w[$s]YY−_]=((($[$s]]YY−__ q"|")?".":$w[$zq"|")?".":$w[$zq|")?"."::$[$zq|")??."::$[[$z|")???.::$$[[$z|| s]);$s++;}for(Qs]);$s++;}for(Qs];$s++;}}or(Qs];$$s+;}}orr(Qs]$$s++;}}orr(Qss 1..75){unless(x1..75){unless(x1.75){unnlss(x1.775){uulsss(x1.75){uuulsss(x11 $w[$_]ne’’){$w%$w[$_]ne’’){$w%$w$_]nee’’{$w%$$w$_]nn’’{{$w%$$w_]nnn’’{{$w%$$ [$_]=$w[($_−1)![$_]=$w[($_−1)![$_=$w[[($_−)![$_==w[[($$_−)![$__w[[[($$_−)![[ ];}}print(joinY];}}print(joinY];}prinnt(joinY;}prinntt(joinY;}pinnntt(joinYY ""|@w);print"\z""|@w);print"\z""|w);;print"\z"|w);;pprint"\z"|w;;ppprint"\zz n";}print@a;,;#n";}print@a;.;#n";priint@a;.;#n;priintt@a;.;#n;piinntt@a;.;## y!|zY\!%x!,Q!;#y!|zY\!%x!.Q!;#y!zY\!!%x!.Q!;#!zY\!!%x!!.Q!;#!z\!!!%x!!.Q!;## s{Q.*\n}[]g;#<>s{Q.*\n}[]g;#<>sQ.*\nn}[]g;#>sQ.*\nn}[]]g;#>sQ.\nnn}[]]g;#>ss eval;#EndFini!$eval;#EndFini!$eal;#EEndFin!$eal;;##nddFin!$ea;;###nddFin!$ee Paul Fenwick Jacinta Richardson Object Oriented Perl by Paul Fenwick and Jacinta Richardson Copyright © 2001-2009 Paul Fenwick ([email protected]) Copyright © 2001-2009 Jacinta Richardson ([email protected]) Copyright © 2001-2009 Perl Training Australia (http://perltraining.com.au) Copyright © 2001 Obsidian Consulting Group Cover artwork Copyright (c) 2001 Marcus Post. Used with permission. The use of a camel image with the topic of Perl is a trademark of O’Reilly & Associates, Inc. Used with permission. Conventions used throughout this text are based upon the conventions used in the Netizen training manuals by Kirrily Robert, and found at http://sourceforge.net/projects/spork Distribution of this work is prohibited unless prior permission is obtained from the copyright holder. This training manual is maintained by Perl Training Australia, and can be found at http://www.perltraining.com.au/notes.html. This is revision 1.13 of Perl Training Australia’s "Object Oriented Perl" training manual. Table of Contents 1. Introduction..................................................................................................................................... 1 Course outline ............................................................................................................................. 1 Assumed knowledge ................................................................................................................... 1 Module objectives ....................................................................................................................... 1 Platform and version details........................................................................................................ 2 The course notes.......................................................................................................................... 2 Other materials............................................................................................................................ 3 2. An object oriented refresher.......................................................................................................... 5 In this chapter.............................................................................................................................. 5 Object orientation in brief........................................................................................................... 5 Objects and methods ................................................................................................................... 5 Classes......................................................................................................................................... 6 Inheritance................................................................................................................................... 7 Multiple inheritance........................................................................................................... 7 Polymorphism............................................................................................................................. 8 Exercise....................................................................................................................................... 8 Ten rules for when to use OO ..................................................................................................... 9 Chapter summary ......................................................................................................................10 3. External Files and Packages ........................................................................................................13 In this chapter............................................................................................................................13 Splitting code between files ......................................................................................................13 Require ............................................................................................................................13 Use strict and warnings ...................................................................................................14 Example...........................................................................................................................14 FindBin............................................................................................................................15 Exercises ...................................................................................................................................15 Introduction to packages ...........................................................................................................15 The scoping operator.................................................................................................................16 Package variables and our.........................................................................................................17 Exercises ...................................................................................................................................18 Chapter summary ......................................................................................................................19 4. Modules..........................................................................................................................................21 In this chapter............................................................................................................................21 Module uses ..............................................................................................................................21 What is a module?.....................................................................................................................21 The double-colon ......................................................................................................................22 Exercise.....................................................................................................................................22 Where does Perl look for modules? ..........................................................................................22 Finding installed modules .........................................................................................................23 Exercise ...........................................................................................................................23 Using CPAN modules......................................................................................................24 Finding quality CPAN modules.......................................................................................25 Writing modules........................................................................................................................25 Use versus require ...........................................................................................................26 Warnings and strict ..........................................................................................................27 Exercise ...........................................................................................................................27 Things to remember... ............................................................................................27
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages142 Page
-
File Size-