Your SlideShare is downloading. ×
Perl 5.10 on OSDC.tw 2009
Perl 5.10 on OSDC.tw 2009
Perl 5.10 on OSDC.tw 2009
Perl 5.10 on OSDC.tw 2009
Perl 5.10 on OSDC.tw 2009
Perl 5.10 on OSDC.tw 2009
Perl 5.10 on OSDC.tw 2009
Perl 5.10 on OSDC.tw 2009
Perl 5.10 on OSDC.tw 2009
Perl 5.10 on OSDC.tw 2009
Perl 5.10 on OSDC.tw 2009
Perl 5.10 on OSDC.tw 2009
Perl 5.10 on OSDC.tw 2009
Perl 5.10 on OSDC.tw 2009
Perl 5.10 on OSDC.tw 2009
Perl 5.10 on OSDC.tw 2009
Perl 5.10 on OSDC.tw 2009
Perl 5.10 on OSDC.tw 2009
Perl 5.10 on OSDC.tw 2009
Perl 5.10 on OSDC.tw 2009
Perl 5.10 on OSDC.tw 2009
Perl 5.10 on OSDC.tw 2009
Perl 5.10 on OSDC.tw 2009
Perl 5.10 on OSDC.tw 2009
Perl 5.10 on OSDC.tw 2009
Perl 5.10 on OSDC.tw 2009
Perl 5.10 on OSDC.tw 2009
Perl 5.10 on OSDC.tw 2009
Perl 5.10 on OSDC.tw 2009
Perl 5.10 on OSDC.tw 2009
Perl 5.10 on OSDC.tw 2009
Perl 5.10 on OSDC.tw 2009
Perl 5.10 on OSDC.tw 2009
Perl 5.10 on OSDC.tw 2009
Perl 5.10 on OSDC.tw 2009
Perl 5.10 on OSDC.tw 2009
Perl 5.10 on OSDC.tw 2009
Perl 5.10 on OSDC.tw 2009
Perl 5.10 on OSDC.tw 2009
Perl 5.10 on OSDC.tw 2009
Perl 5.10 on OSDC.tw 2009
Perl 5.10 on OSDC.tw 2009
Perl 5.10 on OSDC.tw 2009
Perl 5.10 on OSDC.tw 2009
Perl 5.10 on OSDC.tw 2009
Perl 5.10 on OSDC.tw 2009
Perl 5.10 on OSDC.tw 2009
Perl 5.10 on OSDC.tw 2009
Perl 5.10 on OSDC.tw 2009
Perl 5.10 on OSDC.tw 2009
Perl 5.10 on OSDC.tw 2009
Perl 5.10 on OSDC.tw 2009
Perl 5.10 on OSDC.tw 2009
Perl 5.10 on OSDC.tw 2009
Perl 5.10 on OSDC.tw 2009
Perl 5.10 on OSDC.tw 2009
Perl 5.10 on OSDC.tw 2009
Perl 5.10 on OSDC.tw 2009
Perl 5.10 on OSDC.tw 2009
Perl 5.10 on OSDC.tw 2009
Perl 5.10 on OSDC.tw 2009
Perl 5.10 on OSDC.tw 2009
Perl 5.10 on OSDC.tw 2009
Perl 5.10 on OSDC.tw 2009
Perl 5.10 on OSDC.tw 2009
Perl 5.10 on OSDC.tw 2009
Perl 5.10 on OSDC.tw 2009
Perl 5.10 on OSDC.tw 2009
Perl 5.10 on OSDC.tw 2009
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Perl 5.10 on OSDC.tw 2009

1,282

Published on

Presentation of Perl 5.10 on OSDC.tw 2009, 4/19 by scw

Presentation of Perl 5.10 on OSDC.tw 2009, 4/19 by scw

0 Comments
3 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
1,282
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
42
Comments
0
Likes
3
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Perl 5.10
  • 2. OSDC.tw 2009 4/19 scw at csie dot org
  • 3. Who
  • 4. Who? Larry Wall Rafa¨l Garcia-Suarez e
  • 5. When
  • 6. When? Perl 5.8.0: July 18, 2002
  • 7. When? Perl 5.8.0: July 18, 2002 Perl 5.8.9: Dec 14, 2008
  • 8. When? Perl 5.10.0: Dec 18, 2007
  • 9. When? Perl 5.10.0: Dec 18, 2007 Perl 6: By Xmas
  • 10. What
  • 11. What? Compatible (almost) major upgrade
  • 12. What? New language features Interpreter improvements
  • 13. What? Features and inspiration from Perl 6
  • 14. Where
  • 15. Where? Debian 5.0 lenny Ubuntu 8.10 intrepid Fedora 9
  • 16. Where? FreeBSD ports (2009-03-28) ActivePerl 5.10.0.1004
  • 17. How
  • 18. How? apt-get install perl yum update perl
  • 19. How? portsnap fetch update cd lang/perl5.10 make install clean
  • 20. How? portsnap fetch update cd lang/perl5.10 make install clean read /usr/ports/UPDATING !!!
  • 21. Not root?
  • 22. Not root! $ wget http://www.cpan.org/authors/id/ R/RG/RGARCIA/perl-5.10.0.tar.gz $ tar zxf perl-5.10.0.tar.gz; cd perl-5.10.0 $ ./Configure -Dprefix=/usr/local ˜ -Duserelocatableinc $ make -j 8 all test install
  • 23. Why
  • 24. a//a
  • 25. a||a
  • 26. Why? $a // ”Comment?”
  • 27. Why? $a // ”Comment?” defined $a ? $a : ”Comment?”
  • 28. defined-or Apply defined-or patch against perl 5.8 works, too
  • 29. defined-or my $price = mysql select(...) // ”not found”; say ”Price at $price”
  • 30. say say = print + -l Not enabled by default
  • 31. feature use feature qw( ) say, switch, state
  • 32. feature use feature ”:5.10” use 5.010 use v5.10 perl -E
  • 33. feature switch In correct English!!
  • 34. switch given($foo) { when (undef) { say ’$foo is undefined’ } when (”foo”) { say ’$foo is str ”foo”’ } when ([1,3,5,7,9]) { say ’$foo is an odd digit’; continue; } when ($ < 100) { say ’$foo under 100’ } when (&func) { say ’func($foo) true’ } default { die q(I don’t know what to do
  • 35. when my $count = 0; for (@array) { when (”foo”) { ++$count } } say ”array contains $count copies of ’foo’”;
  • 36. given, when & default given(EXPR) = do{ $ = EXPR; ... } when($foo) = when($ ˜˜$foo) default = when(1 == 1)
  • 37. smart match ”Smart matching in detail” in perlsyn $a˜˜$b the same to $b˜˜$a keys for hash content for array
  • 38. PerlRE
  • 39. Engine De-recursivised
  • 40. Engine Trie
  • 41. Engine Aho-Corasick
  • 42. Named Capture
  • 43. Named capture /(?<ip> d+.d+.d+.d+) .-.-.[(?<time>.*?)] .”(?<method>GET|POST) .(?<request>[ˆ ]+) /x
  • 44. Named capture /(?<ip> d+.d+.d+.d+) .-.-.[(?<time>.*?)] .”(?<method>GET|POST) .(?<request>[ˆ ]+) /x $+{’ip’, ’time’, ’method’, ’request’}
  • 45. backreference /(.)1/ /(.)g1/ /(.)g{1}/ /(.)g{-1}/ /(?<letter>.)g{letter}/ /(?<letter>.)k<letter>/
  • 46. Regexp::Keep
  • 47. Regexp::Keep s/(.*)?.*/$1/g
  • 48. Regexp::Keep s/(.*)?.*/$1/g s/.*K?.*//g
  • 49. PerlRE not Regular
  • 50. Recursive /ˆ( # start of line, capture buffer 1 < # match an opening angle brack (? : # match one of: [ˆ <>]+ # one or more non angle br | # ... or ... (?1) # recurse to bracket 1 and try )∗ # 0 or more times. > # match a closing angle bracket ) # end capture buffer one $/x # end of line
  • 51. Recursive /ˆ( # start of line, capture buffer 1 < # match an opening angle brack (? : # match one of: (? > [ˆ <>]+ # one or more non angle br ) | # ... or ... (?1) # recurse to bracket 1 and try )∗ # 0 or more times. > # match a closing angle bracket ) # end capture buffer one $/x # end of line
  • 52. Recursive /ˆ( # start of line, capture buffer 1 < # match an opening angle brack (? : # match one of: [ˆ <>] + + # one or more non angle b | # ... or ... (?1) # recurse to bracket 1 and tr )∗ # 0 or more times. > # match a closing angle bracket ) # end capture buffer one $/x # end of line
  • 53. Backtracking Control Verbs
  • 54. (*FAIL)
  • 55. (*ACCEPT)
  • 56. On (*FAIL)...
  • 57. On (*FAIL)... (*PRUNE) estart this trial (:)
  • 58. On (*FAIL)... aaaaaaaaaaaaaa /a*(*PRUNE)a/
  • 59. On (*FAIL)... (*THEN) ext branch (::)
  • 60. On (*FAIL)... aaaaaaaaaaaaa /a*(*THEN)a/
  • 61. On (*FAIL)... aaaaaaaaaaaaaaaa /a*(*THEN)a|a+/
  • 62. On (*FAIL)... (*COMMIT) ail the match (:::)
  • 63. On (*FAIL)... aaaaaaaaaaaaaaaa /a*(*COMMIT)a/
  • 64. demo parse string
  • 65. man perlre
  • 66. man perldelta
  • 67. Thank you!

×