Quick Upload

Loading...
Flash Player 9 (or above) is needed to view slideshows. We have detected that you do not have it on your computer.To install it, go here
Post to Twitter Post to Twitter
Share on Facebook
Myspace Hi5 Friendster Xanga LiveJournal Facebook Blogger Tagged Typepad Freewebs BlackPlanet gigya icons
« Prev Comments 1 - 10 of 17 Next »
  • guestb0738e
    guestb0738e said 11 months Edit Delete

    Crazy! Using // as OR instead of comment



    Regardless, Happy New Version Day, Perl! We missed thy!

  • rjbs
    rjbs said 11 months Edit Delete

    The slides showing how awful it can be to have to manage your own inside-out objects are not intended to be a robust explanation of how to force yourself to suffer through it, but an overview of the various levels of annoyance that heap up without fieldhashes.

  • MichaelRWolf
    MichaelRWolf said 11 months Edit Delete

    Errata: (?)

    Slide 88:
    =======
    Unless you meant to leave $id as an unused variable to resolve in later slides, I'd suggest this change....

    s( $site{$self} )
    ( $site{$id} )gx

    Slide 89:
    =======
    Ditto

    Also, make these changes
    $new should be $new_id
    $old should be $old_id

  • rjbs
    rjbs said 11 months Edit Delete

    Perl 5.10 has been released!
    http://search.cpan.org/~rgarcia/perl-5.10.0/

  • rjbs
    rjbs said 2 years Edit Delete

    Between the desire
    And the spasm
    Between the potency
    And the existence
    Between the essence
    And the descent
    Falls mtfnpy

  • guestc550da
    guestc550da said 2 years Edit Delete

    first - thanks for posting the summary -

    So, what is the feature mtfnpy on slides 19-24 (perldoc only states that switch, say, and state are features)

  • kevinold
    kevinold said 2 years Edit Delete

    You can download and play with it here: http://search.cpan.org/~rgarcia/perl-5.10.0-RC1/

  • rjbs
    rjbs said 2 years Edit Delete

    I have no idea what that Python/Ruby comment means. Are any of these features, except maybe named regex captures, inspired by Python or Ruby? Not that I can think of.

    I think there are plenty of good ideas to steal from Python and Ruby, but these aren't those. Meanwhile, there are plenty of good ideas for those languages to steal from Perl.

  • guest43e98a
    guest43e98a said 2 years Edit Delete

    Finally, Perl *looked* in direction where Python & Ruby gone long ago q:

  • rjbs
    rjbs said 2 years Edit Delete

    use 5.010;

    sub foo {
    state $x = 100;
    $x = $x + 1;

    say $x;
    }

    foo() for 1 .. 10;


    The above program demonstrates that my slides are correct and perlsub is wrong. I will try to send a patch to p5p.

  • gueste3a37a
    gueste3a37a said 2 years Edit Delete

    According to perlsub in 5.9.5, that should be 'state $lines_left //= 100;' in slide 49, otherwise it's set to 100 every time the sub is entered.

    Which is correct?

  • rjbs
    rjbs said 2 years Edit Delete

    5.9.5 is the current development release. To get the closest thing to a released 5.10, check out http://dev.perl.org/perl5/docs/perlhack.html#Keeping_in_sync

    I *am* glad we have Ruby and Python. Well, mostly Ruby. I don't see how they make me likely to get rid of Perl, though. Perl remains the most useful programming language in my toolbox.

  • guestb419a7
    guestb419a7 said 2 years Edit Delete

    arent we glad we have python and ruby?



    bye bye perl :-)

  • guestc6f0aa
    guestc6f0aa said 2 years Edit Delete

    The problem is ... http://www.perl.org/get.html .... no feckin 5.10!
    Is it 5.9.5?

  • yDNA
    yDNA said 2 years Edit Delete

    Excellent work, rj. Thanks!

  • guestcbc37d
    guestcbc37d said 2 years Edit Delete

    Nice. Thanks for posting it.

  • m1ke
    m1ke said 2 years Edit Delete

    way cool.. can't wait till it's out

Add a comment If you have a SlideShare account, login to comment; otherwise comment as a guest.

    Perl 5.10 for People Who Aren't Totally Insane

    from rjbs, 2 years ago Add as contact

    51608 views | 17 comments | 21 favorites | 82 embeds (Stats)

    Desc: All the hype about perl 5.10 can sound a little intimidating. User-level pragmata! Overloadable smartmatching operator! Thread-safe refkey hashes! For Pete's sake, have you heard about lexically scoped pluggable regexp engines?

    It's enough to make you think that 5.10's changes are just for the hard-core perl hackers, but it couldn't be further from the truth! The new version of Perl is full of changes that are easy to use and pack lots of useful benefits for doing plain old every day Perl programming.

    We'll look at the new features, small and large, and see why you, too, will love 5.10.

    Embed customize close
     

    More Info

    This slideshow is Public

    Views: 51608 Comments: 17 Favorites: 21 Downloads: 1306

    View Details: 51411 on Slideshare 197 from embeds
    All Embeds: Less
    Flagged as inappropriate Flag as inappropriate

    Flag as inappropriate

    Select your reason for flagging this slideshow as inappropriate.

    If needed, use the feedback form to let us know more details.

    Slideshow Transcript

    1. Slide 1: Perl 5.10 for people who are not insane
    2. Slide 2: Perl 5.10 for people who are not totally insane
    3. Slide 3: 5.10 isn’t like 5.8.x perl5100delta
    4. Slide 4: 5.10 isn’t like 5.8.x - features only get added in new 5.x releases perl5100delta
    5. Slide 5: 5.10 isn’t like 5.8.x - features only get added in new 5.x releases - it’s been 5 years since the last release (5.8) perl5100delta
    6. Slide 6: 5.10 is Way Cool perl51000delta
    7. Slide 7: 5.10 is Way Cool - no significant new features in Perl since 2002 perl51000delta
    8. Slide 8: 5.10 is Way Cool - no significant new features in Perl since 2002 - remember how bad you wanted to see Star Wars: Episode 1? perl51000delta
    9. Slide 9: 5.10 is Way Cool - no significant new features in Perl since 2002 - remember how bad you wanted to see Star Wars: Episode 1? - that’s how excited you should be for 5.10 perl51000delta
    10. Slide 10: 5.10 is Way Cool - no significant new features in Perl since 2002 - remember how bad you wanted to see Star Wars: Episode 1? - that’s how excited you should be for 5.10 - but it won’t suck (no POD race scene) perl51000delta
    11. Slide 11: Lexicascopasmartwhat? perl51000delta
    12. Slide 12: Lexicascopasmartwhat? - lexically scoped user pragmata! perl51000delta
    13. Slide 13: Lexicascopasmartwhat? - lexically scoped user pragmata! - pluggable regex compilation engines! perl51000delta
    14. Slide 14: Lexicascopasmartwhat? - lexically scoped user pragmata! - pluggable regex compilation engines! - trie-based non-recursive pattern matching! perl51000delta
    15. Slide 15: Lexicascopasmartwhat? - lexically scoped user pragmata! - pluggable regex compilation engines! - trie-based non-recursive pattern matching! - thread-safe weak refkey hashes! perl51000delta
    16. Slide 16: Yes, You Care perl51000delta
    17. Slide 17: Yes, You Care - Not everything in 5.10 is esoteric. perl51000delta
    18. Slide 18: Yes, You Care - Not everything in 5.10 is esoteric. - Not everything in 5.10 is for gurus. perl51000delta
    19. Slide 19: Yes, You Care - Not everything in 5.10 is esoteric. - Not everything in 5.10 is for gurus. - Not everything in 5.10 is for C programmers. perl51000delta
    20. Slide 20: Yes, You Care - Not everything in 5.10 is esoteric. - Not everything in 5.10 is for gurus. - Not everything in 5.10 is for C programmers. - Not everything in 5.10 is super advanced. perl51000delta
    21. Slide 21: First: A Warning feature
    22. Slide 22: First: A Warning - 5.10 is backwards compatible feature
    23. Slide 23: First: A Warning - 5.10 is backwards compatible - but adds new keywords and operators feature
    24. Slide 24: First: A Warning - 5.10 is backwards compatible - but adds new keywords and operators - they’re not enabled by default feature
    25. Slide 25: First: A Warning - 5.10 is backwards compatible - but adds new keywords and operators - they’re not enabled by default - use feature ‘mtfnpy’; feature
    26. Slide 26: First: A Warning - 5.10 is backwards compatible - but adds new keywords and operators - they’re not enabled by default - use feature ‘mtfnpy’; - use 5.010; feature
    27. Slide 27: First: A Warning - 5.10 is backwards compatible - but adds new keywords and operators - they’re not enabled by default - use feature ‘mtfnpy’; - use 5.010; - read the perldoc feature
    28. Slide 28: First: A Warning - 5.10 is backwards compatible - but adds new keywords and operators - they’re not enabled by default - use feature ‘mtfnpy’; - use 5.010; - read the perldoc I’m a perldoc ref! feature
    29. Slide 29: First: A Warning - 5.10 is backwards compatible - but adds new keywords and operators - they’re not enabled by default - use feature ‘mtfnpy’; - use 5.010; - read the perldoc feature
    30. Slide 30: say what
    31. Slide 31: say $what - new built-in, say - it’s like print - but it adds a newline for you perlfunc
    32. Slide 32: say $what perlfunc
    33. Slide 33: say $what print “Hello, world!\\n”; perlfunc
    34. Slide 34: say $what print “Hello, world!\\n”; print “$message\\n”; perlfunc
    35. Slide 35: say $what print “Hello, world!\\n”; print “$message\\n”; print “$_\\n” for @lines; perlfunc
    36. Slide 36: say $what print “Hello, world!\\n”; say “Hello, world!”; print “$message\\n”; print “$_\\n” for @lines; perlfunc
    37. Slide 37: say $what print “Hello, world!\\n”; say “Hello, world!”; print “$message\\n”; say $message; print “$_\\n” for @lines; perlfunc
    38. Slide 38: say $what print “Hello, world!\\n”; say “Hello, world!”; print “$message\\n”; say $message; print “$_\\n” for @lines; say for @lines; perlfunc
    39. Slide 39: truth and definedness
    40. Slide 40: truth and definedness perlop
    41. Slide 41: truth and definedness sub record_sale { perlop
    42. Slide 42: truth and definedness sub record_sale { my ($product, $amount) = @_; perlop
    43. Slide 43: truth and definedness sub record_sale { my ($product, $amount) = @_; $amount ||= $product->cost; perlop
    44. Slide 44: truth and definedness sub record_sale { my ($product, $amount) = @_; $amount ||= $product->cost; ... perlop
    45. Slide 45: truth and definedness sub record_sale { my ($product, $amount) = @_; $amount ||= $product->cost; ... } perlop
    46. Slide 46: truth and definedness sub record_sale { my ($product, $amount) = @_; $amount = defined $amount ? $amount : $product->cost; ... } perlop
    47. Slide 47: truth and definedness sub record_sale { my ($product, $amount) = @_; $amount ||= $product->cost; ... } perlop
    48. Slide 48: truth and definedness sub record_sale { my ($product, $amount) = @_; $amount ||= $product->cost; ... } perlop
    49. Slide 49: the new OR operator sub record_sale { my ($product, $amount) = @_; $amount //= $product->cost; ... } perlop
    50. Slide 50: the new OR operator $setting = defined $given ? $given : $default; perlop
    51. Slide 51: the new OR operator $setting = $given; unless (defined $setting) { $setting = $default; } perlop
    52. Slide 52: the new OR operator $setting = $given || $default; perlop
    53. Slide 53: the new OR operator $setting = $given // $default; perlop
    54. Slide 54: keeping state
    55. Slide 55: State Variables $lines_left = 100; sub read_line { die “trial period expired” unless $lines_left-- > 0; ... } perlsub
    56. Slide 56: State Variables my $lines_left = 100; sub read_line { die “trial period expired” unless $lines_left-- > 0; ... } perlsub
    57. Slide 57: State Variables { my $lines_left = 100; sub read_line { die “trial period expired” unless $lines_left-- > 0; ... } } perlsub
    58. Slide 58: State Variables package Trial::Period; sub new { my ($class, $arg) = @_; my $guts = { lines_left => $arg->{lines}, error_msg => $arg->{error}, }; return bless $guts => $class; } my $LINES = 100; my $ERROR = “sorry, trial period over”; sub consume_line { my $TRIAL = Trial::Period->new({ my ($self) = @_; lines => $LINES, $self->{lines_left}--; error => $ERROR, } }); sub lines_left { sub read_line { my ($self) = @_; $TRIAL->assert_lines_left; return $self->{lines_left}; ... } } sub assert_lines_left { my ($self) = @_; unless ($self->lines_left) { die $self->{error_msg}; } } 1; perlsub
    59. Slide 59: State Variables { my $lines_left = 100; sub read_line { die “trial period expired” unless $lines_left-- > 0; ... } } perlsub
    60. Slide 60: State Variables sub read_line { state $lines_left = 100; die “trial period expired” unless $lines_left-- > 0; ... } perlsub
    61. Slide 61: -x stacking
    62. Slide 62: Stackable File Tests if ( -f $file and -w $file and -z $file ) { unlink $file; } perlfunc
    63. Slide 63: Stackable File Tests if ( -f $file and -w _ and -z _ ) { unlink $file; } perlfunc
    64. Slide 64: Stackable File Tests if (-f -w -z $file) { unlink $file; } perlfunc
    65. Slide 65: smart matching
    66. Slide 66: Smart Matching perlsyn
    67. Slide 67: Smart Matching - a new kind of comparison operator perlsyn
    68. Slide 68: Smart Matching - a new kind of comparison operator - its behavior depends on its inputs perlsyn
    69. Slide 69: Smart Matching - a new kind of comparison operator - its behavior depends on its inputs - “if these two things match...” perlsyn
    70. Slide 70: Smart Matching - a new kind of comparison operator - its behavior depends on its inputs - “if these two things match...” - hard to tell, easy to show... perlsyn
    71. Slide 71: Smart Matching perlsyn
    72. Slide 72: Smart Matching if ($foo ~~ undef) { ... } perlsyn
    73. Slide 73: Smart Matching if ($foo ~~ undef) { ... } elsif ($foo ~~ @array) { ... } perlsyn
    74. Slide 74: Smart Matching if ($foo ~~ undef) { ... } elsif ($foo ~~ @array) { ... } elsif ($foo ~~ $code) { ... } perlsyn
    75. Slide 75: Smart Matching if ($foo ~~ undef) { ... } elsif ($foo ~~ @array) { ... } elsif ($foo ~~ $code) { ... } elsif ($foo ~~ %hash) { ... } perlsyn
    76. Slide 76: Smart Matching if ($foo ~~ undef) { ... } elsif ($foo ~~ @array) { ... } elsif ($foo ~~ $code) { ... } elsif ($foo ~~ %hash) { ... } elsif ($foo ~~ qr/re/) { ... } perlsyn
    77. Slide 77: Smart Matching if ($foo ~~ undef) { ... } elsif ($foo ~~ @array) { ... } elsif ($foo ~~ $code) { ... } elsif ($foo ~~ %hash) { ... } elsif ($foo ~~ qr/re/) { ... } elsif ($foo ~~ $bar) { ... } perlsyn
    78. Slide 78: Smart Matching if ($foo ~~ undef) { ... } elsif ($foo ~~ @array) { ... } elsif ($foo ~~ $code) { ... } elsif ($foo ~~ %hash) { ... } elsif ($foo ~~ qr/re/) { ... } elsif ($foo ~~ $bar) { ... } else { ... } perlsyn
    79. Slide 79: Smart Matching given ($foo) { when (undef) { ... } when (@array) { ... } when ($code) { ... } when (%hash) { ... } when (qr/re/) { ... } when ($bar) { ... } default { ... } } perlsyn
    80. Slide 80: Smart Matching if ($foo ~~ undef) { ... } elsif ($foo ~~ @array) { ... } elsif ($foo ~~ $code) { ... } elsif ($foo ~~ %hash) { ... } elsif ($foo ~~ qr/re/) { ... } elsif ($foo ~~ $bar) { ... } else { ... } perlsyn
    81. Slide 81: Smart Matching if ($foo ~~ undef) { ... } elsif ($foo ~~ $array) { ... } elsif ($foo ~~ $code) { ... } elsif ($foo ~~ $hash) { ... } elsif ($foo ~~ qr/re/) { ... } elsif ($foo ~~ $bar) { ... } else { ... } perlsyn
    82. Slide 82: Smart Matching my $test; perlsyn
    83. Slide 83: Smart Matching given ($foo) { when (undef) { ... } when ($aref) { ... } when ($code) { ... } when ($href) { ... } when ($regex) { ... } when ($object) { ... } default { ... } } perlsyn
    84. Slide 84: Smart Matching given ($foo) { when ($test_1) { ... } when ($test_2) { ... } when ($test_3) { ... } when ($test_4) { ... } when ($test_5) { ... } when ($test_6) { ... } default { ... } } perlsyn
    85. Slide 85: Smart Matching perlsyn
    86. Slide 86: Smart Matching @want = @have->where($test) perlsyn
    87. Slide 87: Smart Matching @want = @have->where($test) @want = @have->where(sub{ …… }) perlsyn
    88. Slide 88: Smart Matching @want = @have->where($test) @want = @have->where(sub{ …… }) @want = @have->where(qr/.../sm) perlsyn
    89. Slide 89: Smart Matching @want = @have->where($test) @want = @have->where(sub{ …… }) @want = @have->where(qr/.../sm) @want = @have->where([ 1,2,3 ]) perlsyn
    90. Slide 90: Smart Matching perlsyn
    91. Slide 91: Smart Matching sub where { perlsyn
    92. Slide 92: Smart Matching sub where { my ($array, $test) = @_; perlsyn
    93. Slide 93: Smart Matching sub where { my ($array, $test) = @_; if (ref $test eq ‘ARRAY’) { perlsyn
    94. Slide 94: Smart Matching sub where { my ($array, $test) = @_; if (ref $test eq ‘ARRAY’) { my %known = map {$_=>1} @$test; perlsyn
    95. Slide 95: Smart Matching sub where { my ($array, $test) = @_; if (ref $test eq ‘ARRAY’) { my %known = map {$_=>1} @$test; return grep { $known{$_} } @$array; perlsyn
    96. Slide 96: Smart Matching sub where { my ($array, $test) = @_; if (ref $test eq ‘ARRAY’) { my %known = map {$_=>1} @$test; return grep { $known{$_} } @$array; } perlsyn
    97. Slide 97: Smart Matching sub where { my ($array, $test) = @_; if (ref $test eq ‘ARRAY’) { my %known = map {$_=>1} @$test; return grep { $known{$_} } @$array; } if (ref $test eq ‘Regexp’) { perlsyn
    98. Slide 98: Smart Matching sub where { my ($array, $test) = @_; if (ref $test eq ‘ARRAY’) { my %known = map {$_=>1} @$test; return grep { $known{$_} } @$array; } if (ref $test eq ‘Regexp’) { return grep { $_ =~ $test } @$array; perlsyn
    99. Slide 99: Smart Matching sub where { my ($array, $test) = @_; if (ref $test eq ‘ARRAY’) { my %known = map {$_=>1} @$test; return grep { $known{$_} } @$array; } if (ref $test eq ‘Regexp’) { return grep { $_ =~ $test } @$array; } perlsyn
    100. Slide 100: Smart Matching sub where { my ($array, $test) = @_; if (ref $test eq ‘ARRAY’) { my %known = map {$_=>1} @$test; return grep { $known{$_} } @$array; } if (ref $test eq ‘Regexp’) { return grep { $_ =~ $test } @$array; } if (ref $test eq ‘CODE’) { perlsyn
    101. Slide 101: Smart Matching sub where { my ($array, $test) = @_; if (ref $test eq ‘ARRAY’) { my %known = map {$_=>1} @$test; return grep { $known{$_} } @$array; } if (ref $test eq ‘Regexp’) { return grep { $_ =~ $test } @$array; } if (ref $test eq ‘CODE’) { return grep { $test->($_) } @$array; perlsyn
    102. Slide 102: Smart Matching sub where { my ($array, $test) = @_; if (ref $test eq ‘ARRAY’) { my %known = map {$_=>1} @$test; return grep { $known{$_} } @$array; } if (ref $test eq ‘Regexp’) { return grep { $_ =~ $test } @$array; } if (ref $test eq ‘CODE’) { return grep { $test->($_) } @$array; } perlsyn
    103. Slide 103: Smart Matching sub where { my ($array, $test) = @_; if (ref $test eq ‘ARRAY’) { my %known = map {$_=>1} @$test; return grep { $known{$_} } @$array; } if (ref $test eq ‘Regexp’) { return grep { $_ =~ $test } @$array; } if (ref $test eq ‘CODE’) { return grep { $test->($_) } @$array; } die “invalid test” perlsyn
    104. Slide 104: Smart Matching sub where { my ($array, $test) = @_; if (ref $test eq ‘ARRAY’) { my %known = map {$_=>1} @$test; return grep { $known{$_} } @$array; } if (ref $test eq ‘Regexp’) { return grep { $_ =~ $test } @$array; } if (ref $test eq ‘CODE’) { return grep { $test->($_) } @$array; } die “invalid test” } perlsyn
    105. Slide 105: Smart Matching sub where { my ($array, $test) = @_; grep { $_ ~~ $test } @$array; } perlsyn
    106. Slide 106: Smart Matching SmartMatch::Sugar perlsyn
    107. Slide 107: Smart Matching SmartMatch::Sugar @want = @have->where( hash ) perlsyn
    108. Slide 108: Smart Matching SmartMatch::Sugar @want = @have->where( hash ) @want = @have->where( class ) perlsyn
    109. Slide 109: Smart Matching SmartMatch::Sugar @want = @have->where( hash ) @want = @have->where( class ) @want = @have->where(isa(‘Foo’)) perlsyn
    110. Slide 110: unknown undefined
    111. Slide 111: Better Error Message(s) $str = “Greetings, $name. Your last login was $last. It is now $time.”; perldiag
    112. Slide 112: Better Error Message(s) $str = “Greetings, $name. Your last login was $last. It is now $time.”; Use of uninitialized value in concatenation (.) or string at hello.plx line 9. perldiag
    113. Slide 113: Better Error Message(s) $str = “Greetings, $name. Your last login was $last. It is now $time.”; Use of uninitialized value $time in concatenation (.) or string at hello.plx line 9. perldiag
    114. Slide 114: inside-out objects
    115. Slide 115: Inside-Out Objects Hash::Util::FieldHash
    116. Slide 116: Inside-Out Objects - traditional objects are a hashref Hash::Util::FieldHash
    117. Slide 117: Inside-Out Objects - traditional objects are a hashref - look up attrs in the obj itself by attr name Hash::Util::FieldHash
    118. Slide 118: Inside-Out Objects - traditional objects are a hashref - look up attrs in the obj itself by attr name - inside-out objects are content-free refs Hash::Util::FieldHash
    119. Slide 119: Inside-Out Objects - traditional objects are a hashref - look up attrs in the obj itself by attr name - inside-out objects are content-free refs - look up attrs in an external hash by obj id Hash::Util::FieldHash
    120. Slide 120: Inside-Out Objects - traditional objects are a hashref - look up attrs in the obj itself by attr name - inside-out objects are content-free refs - look up attrs in an external hash by obj id - there are complications for inside-out objects Hash::Util::FieldHash
    121. Slide 121: Inside-Out Objects sub size { my $self = shift; if (@_) { return $self->{size} = shift; } else { return $self->{size}; } } Hash::Util::FieldHash
    122. Slide 122: Inside-Out Objects my %size; sub size { my $self = shift; if (@_) { return $size{ $self } = shift; } else { return $size{ $self }; } } Hash::Util::FieldHash
    123. Slide 123: Inside-Out Objects my %size; sub size { my $self = shift; my $id = refaddr $self; if (@_) { return $size{ $id } = shift; } else { return $size{ $id }; } } Hash::Util::FieldHash
    124. Slide 124: Inside-Out Objects my %size; sub size { my $self = shift; my $id = refaddr $self; if (@_) { return $size{ $id } = shift; } else { return $size{ $id }; } } sub DESTROY { my $id = refaddr $_[0]; delete $size{ $id }; } Hash::Util::FieldHash
    125. Slide 125: Inside-Out Objects my %size; sub CLONE { sub size { my $class = shift; my $self = shift; my $id = refaddr $self; my @properties = map { values %$_ } values %PROP_DATA_FOR; if (@_) { return $size{ $id } = shift; for my $old_id ( keys %OBJ ) { } else { return $size{ $id }; my $object = $OBJ{ $old_id }; } my $new_id = refaddr $object; } for my $prop ( @properties ) { sub DESTROY { next unless exists $prop->{ $old }; my $id = refaddr $_[0]; $prop->{ $new } = $prop->{ $old }; delete $size{ $id }; delete $prop->{ $old }; } } weaken ( $OBJ{ $new } = $object ); delete $OBJ{ $old }; } } Hash::Util::FieldHash
    126. Slide 126: Inside-Out Objects my %OBJECT_REGISTRY; sub CLONE { my %size; my $class = shift; sub size { my $self = shift; my @properties = map { values %$_ } my $id = refaddr $self; values %PROP_DATA_FOR; $self->register_object; for my $old_id ( keys %OBJECT_REGISTRY ) { if (@_) { return $size{ $self } = shift; my $object = } else { $OBJECT_REGISTRY{ $old_id }; return $size{ $self }; my $new_id = refaddr $object; } } for my $prop ( @properties ) { next unless exists $prop- sub DESTROY { >{ $old_id }; my $id = refaddr $_[0]; $prop->{ $new_id } = $prop- delete $size{ $id }; >{ $old_id }; delete $OBJECT_REGISTRY{ $id }; delete $prop->{ $old_id }; } } sub register_object { weaken ( $OBJECT_REGISTRY{ $new_id } = my ($self) = @_; $object ); my $id = refaddr $self; delete $OBJECT_REGISTRY{ $old_id }; $OBJECT_REGISTRY{ $id } = $self; } } } Hash::Util::FieldHash
    127. Slide 127: Field Hashes Hash::Util::FieldHash
    128. Slide 128: Field Hashes - they’re just like hashes Hash::Util::FieldHash
    129. Slide 129: Field Hashes - they’re just like hashes - objects as keys become object ids Hash::Util::FieldHash
    130. Slide 130: Field Hashes - they’re just like hashes - objects as keys become object ids - but get destroyed and cloned Hash::Util::FieldHash
    131. Slide 131: Field Hashes my %size; sub size { my $self = shift; if (@_) { return $size{ $self } = shift; } else { return $size{ $self }; } } Hash::Util::FieldHash
    132. Slide 132: Field Hashes fieldhash my %size; sub size { my $self = shift; if (@_) { return $size{ $self } = shift; } else { return $size{ $self }; } } Hash::Util::FieldHash
    133. Slide 133: Field Hashes { fieldhash my %size; sub size { my $self = shift; if (@_) { return $size{ $self } = shift; } else { return $size{ $self }; } } } Hash::Util::FieldHash
    134. Slide 134: Field Hashes sub size { my $self = shift; fieldhash state %size; if (@_) { return $size{ $self } = shift; } else { return $size{ $self }; } } Hash::Util::FieldHash
    135. Slide 135: lexical topic
    136. Slide 136: (topic is how you say $_)
    137. Slide 137: Lexical Topic for (@lines) { chomp; next if /^#/; next unless length; s/a/b/; sanity_check; say; } perlvar
    138. Slide 138: Lexical Topic for my $line (@lines) { chomp $line; next if $line ~~ /^#/; next unless length $line; $line =~ s/a/b/; sanity_check($line); say $line; } perlvar
    139. Slide 139: Lexical Topic for my $_ (@lines) { chomp; next if /^#/; next unless length; s/a/b/; sanity_check; say; } perlvar
    140. Slide 140: Regex
    141. Slide 141: named captures
    142. Slide 142: Regex: Named Captures perlre
    143. Slide 143: Regex: Named Captures - find matches by name, not position perlre
    144. Slide 144: Regex: Named Captures - find matches by name, not position - avoid the dreaded$1 perlre
    145. Slide 145: Regex: Named Captures - find matches by name, not position - avoid the dreaded $1 - no longer second to Python or .Net! perlre
    146. Slide 146: Regex: Named Captures # our hypothetical format section:property = value perlre
    147. Slide 147: Regex: Named Captures $line ~~ /(\\w+):(\\w+) = (\\w+)/; $name = $2; $value = $3; perlre
    148. Slide 148: Regex: Named Captures $lhs_re = qr/(\\w+):(\\w+)/; $rhs_re = qr/(\\w+)/; $line ~~ /$lhs_re = $rhs_re/; $name = $2; $value = $3; perlre
    149. Slide 149: Regex: Named Captures $line ~~ /$lhs_re = $