SlideShare ist ein Scribd-Unternehmen logo
1 von 155
Downloaden Sie, um offline zu lesen
Perl 5.12
                             for everyday use




Sunday, December 5, 2010
5.12 isn’t like 5.10




                                                  perl5100delta
Sunday, December 5, 2010
5.12 isn’t like 5.10


                   - after 5.8, we had to wait 5 years for 5.10



                                                              perl5100delta
Sunday, December 5, 2010
5.12 isn’t like 5.10


                   - after 5.8, we had to wait 5 years for 5.10
                   - 5.12 came out 2 years after 5.10


                                                              perl5100delta
Sunday, December 5, 2010
5.12 is a Nice Change




                                          perl5100delta
Sunday, December 5, 2010
5.12 is a Nice Change

                   - 5.10 was a huge set of changes




                                                      perl5100delta
Sunday, December 5, 2010
5.12 is a Nice Change

                   - 5.10 was a huge set of changes
                   - 5.12 is a lot smaller



                                                      perl5100delta
Sunday, December 5, 2010
5.12 is a Nice Change

                   - 5.10 was a huge set of changes
                   - 5.12 is a lot smaller
                   - 5.12 is not as compelling as 5.10


                                                         perl5100delta
Sunday, December 5, 2010
5.12 is a Nice Change

                   - 5.10 was a huge set of changes
                   - 5.12 is a lot smaller
                   - 5.12 is not as compelling as 5.10
                   - and that’s a good thing

                                                         perl5100delta
Sunday, December 5, 2010
5.12 is a Mixed Bag




                                             perl5100delta
Sunday, December 5, 2010
5.12 is a Mixed Bag

                   - this talk isn’t just for beginners




                                                          perl5100delta
Sunday, December 5, 2010
5.12 is a Mixed Bag

                   - this talk isn’t just for beginners
                   - some of these changes are at the edges



                                                              perl5100delta
Sunday, December 5, 2010
5.12 is a Mixed Bag

                   - this talk isn’t just for beginners
                   - some of these changes are at the edges
                   - but they’re all practical


                                                              perl5100delta
Sunday, December 5, 2010
5.12 is a Mixed Bag

                   - this talk isn’t just for beginners
                   - some of these changes are at the edges
                   - but they’re all practical
                   - except for the ones that aren’t

                                                              perl5100delta
Sunday, December 5, 2010
By the way, 5.14...




                                                 perl5132delta
Sunday, December 5, 2010
By the way, 5.14...

                   - is going to be awesome




                                                 perl5132delta
Sunday, December 5, 2010
By the way, 5.14...

                   - is going to be awesome
                   - and available in about nine months



                                                          perl5132delta
Sunday, December 5, 2010
By the way, 5.14...

                   - is going to be awesome
                   - and available in about nine months
                   - and it’s going to be awesome

                                                          perl5132delta
Sunday, December 5, 2010
...and 5.10 is frozen.




                                                perl5101delta
Sunday, December 5, 2010
...and 5.10 is frozen.

                   - 5.10 is the last release of the old way




                                                               perl5101delta
Sunday, December 5, 2010
...and 5.10 is frozen.

                   - 5.10 is the last release of the old way
                   - that means it got some features backported



                                                           perl5101delta
Sunday, December 5, 2010
...and 5.10 is frozen.

                   - 5.10 is the last release of the old way
                   - that means it got some features backported
                   - that will never happen again


                                                           perl5101delta
Sunday, December 5, 2010
...and 5.10 is frozen.

                   - 5.10 is the last release of the old way
                   - that means it got some features backported
                   - that will never happen again
                   - I’ll point out 5.12isms that got into 5.10.1

                                                             perl5101delta
Sunday, December 5, 2010
but enough about other versions



Sunday, December 5, 2010
let’s talk about 5.12



Sunday, December 5, 2010
First: A Warning




                                              feature
Sunday, December 5, 2010
First: A Warning
                   - 5.12 is backwards compatible




                                                    feature
Sunday, December 5, 2010
First: A Warning
                   - 5.12 is backwards compatible
                   - but adds new keywords and operators




                                                           feature
Sunday, December 5, 2010
First: A Warning
                   - 5.12 is backwards compatible
                   - but adds new keywords and operators
                   - they’re not enabled by default



                                                           feature
Sunday, December 5, 2010
First: A Warning
                   - 5.12 is backwards compatible
                   - but adds new keywords and operators
                   - they’re not enabled by default
                   -       use feature ‘mtfnpy’;




                                                           feature
Sunday, December 5, 2010
First: A Warning
                   - 5.12 is backwards compatible
                   - but adds new keywords and operators
                   - they’re not enabled by default
                   -       use feature ‘mtfnpy’;

                   -       use 5.012;




                                                           feature
Sunday, December 5, 2010
First: A Warning
                   - 5.12 is backwards compatible
                   - but adds new keywords and operators
                   - they’re not enabled by default
                   -       use feature ‘mtfnpy’;

                   -       use 5.012;

                   - read the perldoc
                                                           feature
Sunday, December 5, 2010
First: A Warning
                   - 5.12 is backwards compatible
                   - but adds new keywords and operators
                   - they’re not enabled by default
                   -       use feature ‘mtfnpy’;

                   -       use 5.012;

                   - read the perldoc                I’m a perldoc
                                                          ref!
                                                                 feature
Sunday, December 5, 2010
First: A Warning
                   - 5.12 is backwards compatible
                   - but adds new keywords and operators
                   - they’re not enabled by default
                   -       use feature ‘mtfnpy’;

                   -       use 5.012;

                   - read the perldoc
                                                           feature
Sunday, December 5, 2010
$old ~~ $new




                   - the smart match operator changed


                                                        also in 5.10.1
                                                               perlsyn
Sunday, December 5, 2010
~~

                   - no longer commutative; right side wins
                   - non-overloaded objects can’t be ~~ed
                   - still very complicated (23 behaviors)
                   - you won’t be using this every day

                                                              perldoc
Sunday, December 5, 2010
autodie




                                     also in 5.10.1
                                           autodie
Sunday, December 5, 2010
autodie


                   - like Fatal


                                            also in 5.10.1
                                                  autodie
Sunday, December 5, 2010
autodie


                   - like Fatal
                   - but deadlier

                                              also in 5.10.1
                                                    autodie
Sunday, December 5, 2010
autodie

             open my $fh, ‘>‘, $filename;

             while (<$fh>) {
               ...
             }

             close $fh;




                                            autodie
Sunday, December 5, 2010
autodie
             open my $fh, ‘>‘, $filename
               or die “couldn’t open $filename: $!”;

             while (<$fh>) {
               ...
             }

             close $fh
               or die “couldn’t close $filename: $!”;




                                                        autodie
Sunday, December 5, 2010
autodie
             use autodie;

             open my $fh, ‘<‘, $filename;

             while (<$fh>) {
               ...
             }

             close $fh;




                                            autodie
Sunday, December 5, 2010
autodie
             use autodie;

             open my $fh, ‘>‘, $filename;

             while (<$fh>) {
               no autodie;
               rmdir or warn “couldn’t remove $_: $!”;
             }

             close $fh;



                                                     autodie
Sunday, December 5, 2010
autodie problems


                   - autodie doesn’t affect print
                   - you must close filehandles explicitly


                                                             perldoc
Sunday, December 5, 2010
Unicode

Sunday, December 5, 2010
Perl is Good at Unicode




                                     perlunicode
Sunday, December 5, 2010
Perl 5.12 is Better




                                                 perlunicode
Sunday, December 5, 2010
Perl 5.12 is Better

                   - Unicode 5.2




                                                 perlunicode
Sunday, December 5, 2010
Perl 5.12 is Better

                   - Unicode 5.2
                   - every character property is available



                                                             perlunicode
Sunday, December 5, 2010
Perl 5.12 is Better

                   - Unicode 5.2
                   - every character property is available
                   - X in regex is more sensible

                                                             perlunicode
Sunday, December 5, 2010
“The Unicode Bug”




                                           perlunicode
Sunday, December 5, 2010
“The Unicode Bug”

                   - strings aren’t always treated as Unicode




                                                                perlunicode
Sunday, December 5, 2010
“The Unicode Bug”

                   - strings aren’t always treated as Unicode
                   - this causes weird bugs that take ages to find


                                                               perlunicode
Sunday, December 5, 2010
“The Unicode Bug”

                   - strings aren’t always treated as Unicode
                   - this causes weird bugs that take ages to find
                   -       use feature ‘unicode_strings’;




                                                               perlunicode
Sunday, December 5, 2010
use feature ‘unicode_strings’;




                                              perldoc
Sunday, December 5, 2010
use 5.12.0;




                           perldoc
Sunday, December 5, 2010
use 5.10.0;




                           perldoc
Sunday, December 5, 2010
use 5.10.0;




             use feature qw(
               say
               state
               switch
             );



                               perldoc
Sunday, December 5, 2010
use 5.12.0;




                           perldoc
Sunday, December 5, 2010
use 5.12.0;




             use feature qw(
               say
               state
               switch
               unicode_strings
             );



                                 perldoc
Sunday, December 5, 2010
use 5.12.0;




             use feature qw(
               say
               state
               switch
               unicode_strings
             );

             use strict;

                                 perldoc
Sunday, December 5, 2010
Container Improvements



Sunday, December 5, 2010
my %hash = (a => 1, b => 2);

             while (my ($k, $v) = each %hash) {
               say “value for $k is $v”;
             }




Sunday, December 5, 2010
my %hash = (a => 1, b => 2);

             while (my ($k, $v) = each %hash) {
               say “value for $k is $v”;
             }




             value for a is 1
             value for b is 2




Sunday, December 5, 2010
Sunday, December 5, 2010
my @array = qw(a b);




Sunday, December 5, 2010
my @array = qw(a b);




             value for 0 is b
             value for 1 is a




Sunday, December 5, 2010
my @array = qw(a b);

             for my $k (0 .. $#array) {
               say “value for $k is $array[$k]”;
             }




             value for 0 is b
             value for 1 is a




Sunday, December 5, 2010
my @array = qw(a b);

             while (my ($k, $v) = each @array) {
               say “value for $k is $v”;
             }




             value for 0 is b
             value for 1 is a




Sunday, December 5, 2010
my @array = qw(a b);

             for my $k (0 .. $#array) {
               say “value for $k is $array[$k]”;
             }




             my @array = qw(a b);

             while (my ($k, $v) = each @array) {
               say “value for $k is $v”;
             }



Sunday, December 5, 2010
sub redump {
               my ($href) = @_;
               while (my ($k, $v) = each %hash) {
                 say “value for $k is $v”;
               }
             }

             my %hash = (a => 1, b => 2);

             while (my ($k, $v) = each %hash) {
               print “== $k ==”;
               redump(%hash);
             }



Sunday, December 5, 2010
my @array = qw(a b);

             while (my ($k, $v) = each @array) {
               say “value for $k is $v”;
             }




Sunday, December 5, 2010
my @array = qw(a b);

             while (my ($k, $v) = each @array) {
               say “value for $k is $v”;

                    do_something(@array);
             }




Sunday, December 5, 2010
my @array = qw(a b);

             while (my ($k, $v) = each @array) {
               say “value for $k is $v”;
             }




Sunday, December 5, 2010
my @array = qw(a b);

             while (my ($k, $v) = each @array) {
               my $string = $part_for_maybe_transient->bodyhandle->as_string;
               my $transient_pos = _match_position($string, $Not_An_Error);
               last unless defined $transient_pos;
               my $permanent_pos = _match_position($string, $Really_An_Error);
               my $orig_msg_pos = _match_position($string, $Returned_Message_Below);
               last if _position_before($permanent_pos, $orig_msg_pos);
               if (_position_before($transient_pos, $orig_msg_pos)) {
                 say “value for $k is $v”;
                 last if $message->effective_type eq ‘multipart/report’;
                 last if !$first_part
                      || $first_part->effective_type ne ‘text/plain’;
                 my $string = $first_part->as_string;
                 last if length($string) > 3000;
                 # added return receipt (fix for bug #41870)
                 last if $string !~ /auto.{0,20}reply|return receipt
                            |vacation|(out|away|on holiday).*office/i;
                 $self->log(“looks like an autoreply, ignoring.”);
                 $self->{type} = “vacation autoreply”;
                 $self->{is_bounce} = 0;
                 return $self;
               }
             }




Sunday, December 5, 2010
AVOID
                           each @array


Sunday, December 5, 2010
local ??



Sunday, December 5, 2010
use Ancient::Utility qw(stuff);

             my $result = do {
               local $Ancient::Utility::WIDTH = 10;
               stuff( $input );
             };




Sunday, December 5, 2010
my $href = { a => 1, b => 2 };

             my $result = do {
               local $href->{a} = 3;
               stuff( $href );
             };




Sunday, December 5, 2010
my $href = { a => 1, b => 2 };

             my $result = do {
               delete local $href->{a};
               stuff( $href );
             };




Sunday, December 5, 2010
$]



Sunday, December 5, 2010
$[



Sunday, December 5, 2010
$[ - first index of array




                                  perlvar
Sunday, December 5, 2010
$[ - first index of array


                   - so you can make $array[1] mean first




                                                            perlvar
Sunday, December 5, 2010
$[ - first index of array


                   - so you can make $array[1] mean first
                   - isn’t that awesome???



                                                            perlvar
Sunday, December 5, 2010
$[ - first index of array


                   - so you can make $array[1] mean first
                   - isn’t that awesome???
                   - yeah, about as awesome as Comic Sans


                                                        perlvar
Sunday, December 5, 2010
$[

             $[ = 1;

             for (1 .. $#array) {
               ...
             }




                                    perlvar
Sunday, December 5, 2010
$[

             for ($[ .. $#array) {
               ...
             }




                                     perlvar
Sunday, December 5, 2010
$[

             Assigned to $[. Are you some kind of
             idiot or something? at -e line 123.




                                                    perlvar
Sunday, December 5, 2010
$[

             Use of assignment to $[ is deprecated
             at -e line 123.




                                                     perlvar
Sunday, December 5, 2010
More About Deprecations



Sunday, December 5, 2010
@INC



Sunday, December 5, 2010
@INC:
               /usr/pkg/lib/perl5/5.8.0/i386-solaris
               /usr/pkg/lib/perl5/5.8.0
               /usr/pkg/lib/perl5/site_perl/5.8.0/i386-solaris
               /usr/pkg/lib/perl5/site_perl/5.8.0
               /usr/pkg/lib/perl5/site_perl
               /usr/pkg/lib/perl5/vendor_perl/5.8.0/i386-solaris
               /usr/pkg/lib/perl5/vendor_perl/5.8.0
               /usr/pkg/lib/perl5/vendor_perl




                                                                   perlvar
Sunday, December 5, 2010
@INC:
               /usr/pkg/lib/perl5/5.8.0/i386-solaris
               /usr/pkg/lib/perl5/5.8.0
               /usr/pkg/lib/perl5/site_perl/5.8.0/i386-solaris
               /usr/pkg/lib/perl5/site_perl/5.8.0
               /usr/pkg/lib/perl5/site_perl
               /usr/pkg/lib/perl5/vendor_perl/5.8.0/i386-solaris
               /usr/pkg/lib/perl5/vendor_perl/5.8.0
               /usr/pkg/lib/perl5/vendor_perl




                                                                   perlvar
Sunday, December 5, 2010
@INC:
               /usr/pkg/lib/perl5/site_perl/5.8.0/i386-solaris
               /usr/pkg/lib/perl5/site_perl/5.8.0
               /usr/pkg/lib/perl5/site_perl
               /usr/pkg/lib/perl5/vendor_perl/5.8.0/i386-solaris
               /usr/pkg/lib/perl5/vendor_perl/5.8.0
               /usr/pkg/lib/perl5/vendor_perl
               /usr/pkg/lib/perl5/5.8.0/i386-solaris
               /usr/pkg/lib/perl5/5.8.0




                                                                   perlvar
Sunday, December 5, 2010
now we can remove stuff
           from the core distribution


Sunday, December 5, 2010
Class::ISA
         Pod::Plainer
         Shell


Sunday, December 5, 2010
Class::ISA
         Pod::Plainer
         Shell
         Switch

Sunday, December 5, 2010
… and …



Sunday, December 5, 2010
Sunday, December 5, 2010
my $x = get_input;




Sunday, December 5, 2010
my $x = get_input;

             if ( $x >= 0 ) {




Sunday, December 5, 2010
my $x = get_input;

             if ( $x >= 0 ) {
               do_something for 0 .. $x;




Sunday, December 5, 2010
my $x = get_input;

             if ( $x >= 0 ) {
               do_something for 0 .. $x;
             } else {




Sunday, December 5, 2010
my $x = get_input;

             if ( $x >= 0 ) {
               do_something for 0 .. $x;
             } else {
               ...




Sunday, December 5, 2010
my $x = get_input;

             if ( $x >= 0 ) {
               do_something for 0 .. $x;
             } else {
               ...
             }




Sunday, December 5, 2010
my $x = get_input;

             if ( $x >= 0 ) {
               do_something for 0 .. $x;
             } else {
               ...
             }




Sunday, December 5, 2010
my $x = get_input;

             if ( $x >= 0 ) {
               do_something for 0 .. $x;
             } else {
               die “Unimplemented”
             }




Sunday, December 5, 2010
sub virtual_method { ... }




Sunday, December 5, 2010
sub method_I_will_write_later { ... }




Sunday, December 5, 2010
Unimplemented at Some::Library line 123




Sunday, December 5, 2010
AVOID
                            ...


Sunday, December 5, 2010
AVOID
                                         ...
                           (except maybe in slides and pseudocode)



Sunday, December 5, 2010
sub virtual_method {
               confess ‘...’
             }

             sub method_I_will_write_later {
               confess ‘...’
             }




Sunday, December 5, 2010
error message
                           improvements


Sunday, December 5, 2010
perldiag
Sunday, December 5, 2010
perldiag
Sunday, December 5, 2010
perldiag
Sunday, December 5, 2010
perl -MCGI -e’my $q = CGI->new;’
             Unrecognized character xE2 in column
             12 at -e line 1.




                                                perldiag
Sunday, December 5, 2010
perl -MCGI -e’my $q = CGI->new;’
             Unrecognized character xE2 in column
             12 at -e line 1.



             perl -MCGI -e’my $q = CGI­−->new;’
             Unrecognized character xE2; marked
             by <-- HERE after y $q = CGI<-- HERE
             near column 12 at -e line 1.




                                                perldiag
Sunday, December 5, 2010
My Favorite 5.10-ism?

             $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
Sunday, December 5, 2010
My Favorite 5.12-ism?
             if (length $input->{new_email}) {
               $user->update_email(...);
             }




                                                   perldiag
Sunday, December 5, 2010
My Favorite 5.12-ism?
             if (length $input->{new_email}) {
               $user->update_email(...);
             }




             Use of uninitialized value in length
             at - line 3120.



                                                   perldiag
Sunday, December 5, 2010
My Favorite 5.12-ism?
             if (length $input->{new_email}) {
               $user->update_email(...);
             }




                                                   perldiag
Sunday, December 5, 2010
overloading



Sunday, December 5, 2010
my $object = Object->new;

             print $object;




Sunday, December 5, 2010
my $object = Object->new;

             {
                    no overloading;
                    print $object;
             }




Sunday, December 5, 2010
my $filename = get_filename;

             if (-d $filename) {
               handle_directory($filename);
             }




Sunday, December 5, 2010
package Filename;

             use overload ‘-X’ => sub {
               my ($self, $test) = @_;
               return $self->is_dir if $test eq ‘d’;
               return $self->cd_able if $test eq ‘x’;
               ...;
             };




Sunday, December 5, 2010
my $file = get_file;

             if (-d $file) {
               handle_directory($file);
             }




Sunday, December 5, 2010
my $filename = get_file;

             if (-d $file and -x _) {
               handle_directory($file);
             }




Sunday, December 5, 2010
my $filename = get_filename;

             if (-d -x $filename) {
               handle_directory($filename);
             }




Sunday, December 5, 2010
AVOID
                           overload -X


Sunday, December 5, 2010
y2038



Sunday, December 5, 2010
Sunday, December 5, 2010
~$ perl5.10.0 -E ‘say scalar localtime 2**31-1’




Sunday, December 5, 2010
~$ perl5.10.0 -E ‘say scalar localtime 2**31-1’
             Mon Jan 18 22:14:07 2038




Sunday, December 5, 2010
~$ perl5.10.0 -E ‘say scalar localtime 2**31-1’
             Mon Jan 18 22:14:07 2038

             ~$ perl5.10.0 -E ‘say scalar localtime 2**31’




Sunday, December 5, 2010
~$ perl5.10.0 -E ‘say scalar localtime 2**31-1’
             Mon Jan 18 22:14:07 2038

             ~$ perl5.10.0 -E ‘say scalar localtime 2**31’
             Fri Dec 13 15:45:52 1901




Sunday, December 5, 2010
Sunday, December 5, 2010
~$ perl5.12.0 -E ‘say scalar localtime 2**31-1’




Sunday, December 5, 2010
~$ perl5.12.0 -E ‘say scalar localtime 2**31-1’
             Mon Jan 18 22:14:07 2038




Sunday, December 5, 2010
~$ perl5.12.0 -E ‘say scalar localtime 2**31-1’
             Mon Jan 18 22:14:07 2038

             ~$ perl5.12.0 -E ‘say scalar localtime 2**31’




Sunday, December 5, 2010
~$ perl5.12.0 -E ‘say scalar localtime 2**31-1’
             Mon Jan 18 22:14:07 2038

             ~$ perl5.12.0 -E ‘say scalar localtime 2**31’
             Mon Jan 18 22:14:08 2038




Sunday, December 5, 2010
some non-everyday changes



Sunday, December 5, 2010
Method Resolution Order
                               A



                           B       C



                               D


                                       mro
Sunday, December 5, 2010
Method Resolution Order
                                            A

                   - 5.8 : D, B, A, C
                                        B       C



                                            D


                                                    mro
Sunday, December 5, 2010
Method Resolution Order
                                            A

                   - 5.8 : D, B, A, C
                   - 5.10: D, B, C, A   B       C



                                            D


                                                    mro
Sunday, December 5, 2010
Method Resolution Order
                                            A

                   - 5.8 : D, B, A, C
                   - 5.10: D, B, C, A   B       C

                   - 5.12: Anything!
                                            D


                                                    mro
Sunday, December 5, 2010
Method Resolution Order
                                            A

                   - 5.8 : D, B, A, C
                   - 5.10: D, B, C, A   B         C

                   - 5.12: F
                                            D


                                                MRO::Define
Sunday, December 5, 2010
use strict;
             use warnings;

             package Booster::Gold;
             our $VERSION = ‘1.00’;

             ...

             1;




Sunday, December 5, 2010
use 5.12.0;
             use warnings;

             package Booster::Gold 1.00;

             ...

             1;




Sunday, December 5, 2010
use 5.14.0;
             use warnings;

             package Booster::Gold 1.00 {
               ...
             }

             1;




Sunday, December 5, 2010
http://www.perl.org/get.html




Sunday, December 5, 2010
Any questions?

Sunday, December 5, 2010

Weitere ähnliche Inhalte

Empfohlen

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by HubspotMarius Sescu
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTExpeed Software
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsPixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 

Empfohlen (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

Perl 5.12 for Everyday Use

  • 1. Perl 5.12 for everyday use Sunday, December 5, 2010
  • 2. 5.12 isn’t like 5.10 perl5100delta Sunday, December 5, 2010
  • 3. 5.12 isn’t like 5.10 - after 5.8, we had to wait 5 years for 5.10 perl5100delta Sunday, December 5, 2010
  • 4. 5.12 isn’t like 5.10 - after 5.8, we had to wait 5 years for 5.10 - 5.12 came out 2 years after 5.10 perl5100delta Sunday, December 5, 2010
  • 5. 5.12 is a Nice Change perl5100delta Sunday, December 5, 2010
  • 6. 5.12 is a Nice Change - 5.10 was a huge set of changes perl5100delta Sunday, December 5, 2010
  • 7. 5.12 is a Nice Change - 5.10 was a huge set of changes - 5.12 is a lot smaller perl5100delta Sunday, December 5, 2010
  • 8. 5.12 is a Nice Change - 5.10 was a huge set of changes - 5.12 is a lot smaller - 5.12 is not as compelling as 5.10 perl5100delta Sunday, December 5, 2010
  • 9. 5.12 is a Nice Change - 5.10 was a huge set of changes - 5.12 is a lot smaller - 5.12 is not as compelling as 5.10 - and that’s a good thing perl5100delta Sunday, December 5, 2010
  • 10. 5.12 is a Mixed Bag perl5100delta Sunday, December 5, 2010
  • 11. 5.12 is a Mixed Bag - this talk isn’t just for beginners perl5100delta Sunday, December 5, 2010
  • 12. 5.12 is a Mixed Bag - this talk isn’t just for beginners - some of these changes are at the edges perl5100delta Sunday, December 5, 2010
  • 13. 5.12 is a Mixed Bag - this talk isn’t just for beginners - some of these changes are at the edges - but they’re all practical perl5100delta Sunday, December 5, 2010
  • 14. 5.12 is a Mixed Bag - this talk isn’t just for beginners - some of these changes are at the edges - but they’re all practical - except for the ones that aren’t perl5100delta Sunday, December 5, 2010
  • 15. By the way, 5.14... perl5132delta Sunday, December 5, 2010
  • 16. By the way, 5.14... - is going to be awesome perl5132delta Sunday, December 5, 2010
  • 17. By the way, 5.14... - is going to be awesome - and available in about nine months perl5132delta Sunday, December 5, 2010
  • 18. By the way, 5.14... - is going to be awesome - and available in about nine months - and it’s going to be awesome perl5132delta Sunday, December 5, 2010
  • 19. ...and 5.10 is frozen. perl5101delta Sunday, December 5, 2010
  • 20. ...and 5.10 is frozen. - 5.10 is the last release of the old way perl5101delta Sunday, December 5, 2010
  • 21. ...and 5.10 is frozen. - 5.10 is the last release of the old way - that means it got some features backported perl5101delta Sunday, December 5, 2010
  • 22. ...and 5.10 is frozen. - 5.10 is the last release of the old way - that means it got some features backported - that will never happen again perl5101delta Sunday, December 5, 2010
  • 23. ...and 5.10 is frozen. - 5.10 is the last release of the old way - that means it got some features backported - that will never happen again - I’ll point out 5.12isms that got into 5.10.1 perl5101delta Sunday, December 5, 2010
  • 24. but enough about other versions Sunday, December 5, 2010
  • 25. let’s talk about 5.12 Sunday, December 5, 2010
  • 26. First: A Warning feature Sunday, December 5, 2010
  • 27. First: A Warning - 5.12 is backwards compatible feature Sunday, December 5, 2010
  • 28. First: A Warning - 5.12 is backwards compatible - but adds new keywords and operators feature Sunday, December 5, 2010
  • 29. First: A Warning - 5.12 is backwards compatible - but adds new keywords and operators - they’re not enabled by default feature Sunday, December 5, 2010
  • 30. First: A Warning - 5.12 is backwards compatible - but adds new keywords and operators - they’re not enabled by default - use feature ‘mtfnpy’; feature Sunday, December 5, 2010
  • 31. First: A Warning - 5.12 is backwards compatible - but adds new keywords and operators - they’re not enabled by default - use feature ‘mtfnpy’; - use 5.012; feature Sunday, December 5, 2010
  • 32. First: A Warning - 5.12 is backwards compatible - but adds new keywords and operators - they’re not enabled by default - use feature ‘mtfnpy’; - use 5.012; - read the perldoc feature Sunday, December 5, 2010
  • 33. First: A Warning - 5.12 is backwards compatible - but adds new keywords and operators - they’re not enabled by default - use feature ‘mtfnpy’; - use 5.012; - read the perldoc I’m a perldoc ref! feature Sunday, December 5, 2010
  • 34. First: A Warning - 5.12 is backwards compatible - but adds new keywords and operators - they’re not enabled by default - use feature ‘mtfnpy’; - use 5.012; - read the perldoc feature Sunday, December 5, 2010
  • 35. $old ~~ $new - the smart match operator changed also in 5.10.1 perlsyn Sunday, December 5, 2010
  • 36. ~~ - no longer commutative; right side wins - non-overloaded objects can’t be ~~ed - still very complicated (23 behaviors) - you won’t be using this every day perldoc Sunday, December 5, 2010
  • 37. autodie also in 5.10.1 autodie Sunday, December 5, 2010
  • 38. autodie - like Fatal also in 5.10.1 autodie Sunday, December 5, 2010
  • 39. autodie - like Fatal - but deadlier also in 5.10.1 autodie Sunday, December 5, 2010
  • 40. autodie open my $fh, ‘>‘, $filename; while (<$fh>) { ... } close $fh; autodie Sunday, December 5, 2010
  • 41. autodie open my $fh, ‘>‘, $filename or die “couldn’t open $filename: $!”; while (<$fh>) { ... } close $fh or die “couldn’t close $filename: $!”; autodie Sunday, December 5, 2010
  • 42. autodie use autodie; open my $fh, ‘<‘, $filename; while (<$fh>) { ... } close $fh; autodie Sunday, December 5, 2010
  • 43. autodie use autodie; open my $fh, ‘>‘, $filename; while (<$fh>) { no autodie; rmdir or warn “couldn’t remove $_: $!”; } close $fh; autodie Sunday, December 5, 2010
  • 44. autodie problems - autodie doesn’t affect print - you must close filehandles explicitly perldoc Sunday, December 5, 2010
  • 46. Perl is Good at Unicode perlunicode Sunday, December 5, 2010
  • 47. Perl 5.12 is Better perlunicode Sunday, December 5, 2010
  • 48. Perl 5.12 is Better - Unicode 5.2 perlunicode Sunday, December 5, 2010
  • 49. Perl 5.12 is Better - Unicode 5.2 - every character property is available perlunicode Sunday, December 5, 2010
  • 50. Perl 5.12 is Better - Unicode 5.2 - every character property is available - X in regex is more sensible perlunicode Sunday, December 5, 2010
  • 51. “The Unicode Bug” perlunicode Sunday, December 5, 2010
  • 52. “The Unicode Bug” - strings aren’t always treated as Unicode perlunicode Sunday, December 5, 2010
  • 53. “The Unicode Bug” - strings aren’t always treated as Unicode - this causes weird bugs that take ages to find perlunicode Sunday, December 5, 2010
  • 54. “The Unicode Bug” - strings aren’t always treated as Unicode - this causes weird bugs that take ages to find - use feature ‘unicode_strings’; perlunicode Sunday, December 5, 2010
  • 55. use feature ‘unicode_strings’; perldoc Sunday, December 5, 2010
  • 56. use 5.12.0; perldoc Sunday, December 5, 2010
  • 57. use 5.10.0; perldoc Sunday, December 5, 2010
  • 58. use 5.10.0; use feature qw( say state switch ); perldoc Sunday, December 5, 2010
  • 59. use 5.12.0; perldoc Sunday, December 5, 2010
  • 60. use 5.12.0; use feature qw( say state switch unicode_strings ); perldoc Sunday, December 5, 2010
  • 61. use 5.12.0; use feature qw( say state switch unicode_strings ); use strict; perldoc Sunday, December 5, 2010
  • 63. my %hash = (a => 1, b => 2); while (my ($k, $v) = each %hash) { say “value for $k is $v”; } Sunday, December 5, 2010
  • 64. my %hash = (a => 1, b => 2); while (my ($k, $v) = each %hash) { say “value for $k is $v”; } value for a is 1 value for b is 2 Sunday, December 5, 2010
  • 66. my @array = qw(a b); Sunday, December 5, 2010
  • 67. my @array = qw(a b); value for 0 is b value for 1 is a Sunday, December 5, 2010
  • 68. my @array = qw(a b); for my $k (0 .. $#array) { say “value for $k is $array[$k]”; } value for 0 is b value for 1 is a Sunday, December 5, 2010
  • 69. my @array = qw(a b); while (my ($k, $v) = each @array) { say “value for $k is $v”; } value for 0 is b value for 1 is a Sunday, December 5, 2010
  • 70. my @array = qw(a b); for my $k (0 .. $#array) { say “value for $k is $array[$k]”; } my @array = qw(a b); while (my ($k, $v) = each @array) { say “value for $k is $v”; } Sunday, December 5, 2010
  • 71. sub redump { my ($href) = @_; while (my ($k, $v) = each %hash) { say “value for $k is $v”; } } my %hash = (a => 1, b => 2); while (my ($k, $v) = each %hash) { print “== $k ==”; redump(%hash); } Sunday, December 5, 2010
  • 72. my @array = qw(a b); while (my ($k, $v) = each @array) { say “value for $k is $v”; } Sunday, December 5, 2010
  • 73. my @array = qw(a b); while (my ($k, $v) = each @array) { say “value for $k is $v”; do_something(@array); } Sunday, December 5, 2010
  • 74. my @array = qw(a b); while (my ($k, $v) = each @array) { say “value for $k is $v”; } Sunday, December 5, 2010
  • 75. my @array = qw(a b); while (my ($k, $v) = each @array) { my $string = $part_for_maybe_transient->bodyhandle->as_string; my $transient_pos = _match_position($string, $Not_An_Error); last unless defined $transient_pos; my $permanent_pos = _match_position($string, $Really_An_Error); my $orig_msg_pos = _match_position($string, $Returned_Message_Below); last if _position_before($permanent_pos, $orig_msg_pos); if (_position_before($transient_pos, $orig_msg_pos)) { say “value for $k is $v”; last if $message->effective_type eq ‘multipart/report’; last if !$first_part || $first_part->effective_type ne ‘text/plain’; my $string = $first_part->as_string; last if length($string) > 3000; # added return receipt (fix for bug #41870) last if $string !~ /auto.{0,20}reply|return receipt |vacation|(out|away|on holiday).*office/i; $self->log(“looks like an autoreply, ignoring.”); $self->{type} = “vacation autoreply”; $self->{is_bounce} = 0; return $self; } } Sunday, December 5, 2010
  • 76. AVOID each @array Sunday, December 5, 2010
  • 78. use Ancient::Utility qw(stuff); my $result = do { local $Ancient::Utility::WIDTH = 10; stuff( $input ); }; Sunday, December 5, 2010
  • 79. my $href = { a => 1, b => 2 }; my $result = do { local $href->{a} = 3; stuff( $href ); }; Sunday, December 5, 2010
  • 80. my $href = { a => 1, b => 2 }; my $result = do { delete local $href->{a}; stuff( $href ); }; Sunday, December 5, 2010
  • 83. $[ - first index of array perlvar Sunday, December 5, 2010
  • 84. $[ - first index of array - so you can make $array[1] mean first perlvar Sunday, December 5, 2010
  • 85. $[ - first index of array - so you can make $array[1] mean first - isn’t that awesome??? perlvar Sunday, December 5, 2010
  • 86. $[ - first index of array - so you can make $array[1] mean first - isn’t that awesome??? - yeah, about as awesome as Comic Sans perlvar Sunday, December 5, 2010
  • 87. $[ $[ = 1; for (1 .. $#array) { ... } perlvar Sunday, December 5, 2010
  • 88. $[ for ($[ .. $#array) { ... } perlvar Sunday, December 5, 2010
  • 89. $[ Assigned to $[. Are you some kind of idiot or something? at -e line 123. perlvar Sunday, December 5, 2010
  • 90. $[ Use of assignment to $[ is deprecated at -e line 123. perlvar Sunday, December 5, 2010
  • 93. @INC: /usr/pkg/lib/perl5/5.8.0/i386-solaris /usr/pkg/lib/perl5/5.8.0 /usr/pkg/lib/perl5/site_perl/5.8.0/i386-solaris /usr/pkg/lib/perl5/site_perl/5.8.0 /usr/pkg/lib/perl5/site_perl /usr/pkg/lib/perl5/vendor_perl/5.8.0/i386-solaris /usr/pkg/lib/perl5/vendor_perl/5.8.0 /usr/pkg/lib/perl5/vendor_perl perlvar Sunday, December 5, 2010
  • 94. @INC: /usr/pkg/lib/perl5/5.8.0/i386-solaris /usr/pkg/lib/perl5/5.8.0 /usr/pkg/lib/perl5/site_perl/5.8.0/i386-solaris /usr/pkg/lib/perl5/site_perl/5.8.0 /usr/pkg/lib/perl5/site_perl /usr/pkg/lib/perl5/vendor_perl/5.8.0/i386-solaris /usr/pkg/lib/perl5/vendor_perl/5.8.0 /usr/pkg/lib/perl5/vendor_perl perlvar Sunday, December 5, 2010
  • 95. @INC: /usr/pkg/lib/perl5/site_perl/5.8.0/i386-solaris /usr/pkg/lib/perl5/site_perl/5.8.0 /usr/pkg/lib/perl5/site_perl /usr/pkg/lib/perl5/vendor_perl/5.8.0/i386-solaris /usr/pkg/lib/perl5/vendor_perl/5.8.0 /usr/pkg/lib/perl5/vendor_perl /usr/pkg/lib/perl5/5.8.0/i386-solaris /usr/pkg/lib/perl5/5.8.0 perlvar Sunday, December 5, 2010
  • 96. now we can remove stuff from the core distribution Sunday, December 5, 2010
  • 97. Class::ISA Pod::Plainer Shell Sunday, December 5, 2010
  • 98. Class::ISA Pod::Plainer Shell Switch Sunday, December 5, 2010
  • 99. … and … Sunday, December 5, 2010
  • 101. my $x = get_input; Sunday, December 5, 2010
  • 102. my $x = get_input; if ( $x >= 0 ) { Sunday, December 5, 2010
  • 103. my $x = get_input; if ( $x >= 0 ) { do_something for 0 .. $x; Sunday, December 5, 2010
  • 104. my $x = get_input; if ( $x >= 0 ) { do_something for 0 .. $x; } else { Sunday, December 5, 2010
  • 105. my $x = get_input; if ( $x >= 0 ) { do_something for 0 .. $x; } else { ... Sunday, December 5, 2010
  • 106. my $x = get_input; if ( $x >= 0 ) { do_something for 0 .. $x; } else { ... } Sunday, December 5, 2010
  • 107. my $x = get_input; if ( $x >= 0 ) { do_something for 0 .. $x; } else { ... } Sunday, December 5, 2010
  • 108. my $x = get_input; if ( $x >= 0 ) { do_something for 0 .. $x; } else { die “Unimplemented” } Sunday, December 5, 2010
  • 109. sub virtual_method { ... } Sunday, December 5, 2010
  • 110. sub method_I_will_write_later { ... } Sunday, December 5, 2010
  • 111. Unimplemented at Some::Library line 123 Sunday, December 5, 2010
  • 112. AVOID ... Sunday, December 5, 2010
  • 113. AVOID ... (except maybe in slides and pseudocode) Sunday, December 5, 2010
  • 114. sub virtual_method { confess ‘...’ } sub method_I_will_write_later { confess ‘...’ } Sunday, December 5, 2010
  • 115. error message improvements Sunday, December 5, 2010
  • 119. perl -MCGI -e’my $q = CGI->new;’ Unrecognized character xE2 in column 12 at -e line 1. perldiag Sunday, December 5, 2010
  • 120. perl -MCGI -e’my $q = CGI->new;’ Unrecognized character xE2 in column 12 at -e line 1. perl -MCGI -e’my $q = CGI­−->new;’ Unrecognized character xE2; marked by <-- HERE after y $q = CGI<-- HERE near column 12 at -e line 1. perldiag Sunday, December 5, 2010
  • 121. My Favorite 5.10-ism? $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 Sunday, December 5, 2010
  • 122. My Favorite 5.12-ism? if (length $input->{new_email}) { $user->update_email(...); } perldiag Sunday, December 5, 2010
  • 123. My Favorite 5.12-ism? if (length $input->{new_email}) { $user->update_email(...); } Use of uninitialized value in length at - line 3120. perldiag Sunday, December 5, 2010
  • 124. My Favorite 5.12-ism? if (length $input->{new_email}) { $user->update_email(...); } perldiag Sunday, December 5, 2010
  • 126. my $object = Object->new; print $object; Sunday, December 5, 2010
  • 127. my $object = Object->new; { no overloading; print $object; } Sunday, December 5, 2010
  • 128. my $filename = get_filename; if (-d $filename) { handle_directory($filename); } Sunday, December 5, 2010
  • 129. package Filename; use overload ‘-X’ => sub { my ($self, $test) = @_; return $self->is_dir if $test eq ‘d’; return $self->cd_able if $test eq ‘x’; ...; }; Sunday, December 5, 2010
  • 130. my $file = get_file; if (-d $file) { handle_directory($file); } Sunday, December 5, 2010
  • 131. my $filename = get_file; if (-d $file and -x _) { handle_directory($file); } Sunday, December 5, 2010
  • 132. my $filename = get_filename; if (-d -x $filename) { handle_directory($filename); } Sunday, December 5, 2010
  • 133. AVOID overload -X Sunday, December 5, 2010
  • 136. ~$ perl5.10.0 -E ‘say scalar localtime 2**31-1’ Sunday, December 5, 2010
  • 137. ~$ perl5.10.0 -E ‘say scalar localtime 2**31-1’ Mon Jan 18 22:14:07 2038 Sunday, December 5, 2010
  • 138. ~$ perl5.10.0 -E ‘say scalar localtime 2**31-1’ Mon Jan 18 22:14:07 2038 ~$ perl5.10.0 -E ‘say scalar localtime 2**31’ Sunday, December 5, 2010
  • 139. ~$ perl5.10.0 -E ‘say scalar localtime 2**31-1’ Mon Jan 18 22:14:07 2038 ~$ perl5.10.0 -E ‘say scalar localtime 2**31’ Fri Dec 13 15:45:52 1901 Sunday, December 5, 2010
  • 141. ~$ perl5.12.0 -E ‘say scalar localtime 2**31-1’ Sunday, December 5, 2010
  • 142. ~$ perl5.12.0 -E ‘say scalar localtime 2**31-1’ Mon Jan 18 22:14:07 2038 Sunday, December 5, 2010
  • 143. ~$ perl5.12.0 -E ‘say scalar localtime 2**31-1’ Mon Jan 18 22:14:07 2038 ~$ perl5.12.0 -E ‘say scalar localtime 2**31’ Sunday, December 5, 2010
  • 144. ~$ perl5.12.0 -E ‘say scalar localtime 2**31-1’ Mon Jan 18 22:14:07 2038 ~$ perl5.12.0 -E ‘say scalar localtime 2**31’ Mon Jan 18 22:14:08 2038 Sunday, December 5, 2010
  • 146. Method Resolution Order A B C D mro Sunday, December 5, 2010
  • 147. Method Resolution Order A - 5.8 : D, B, A, C B C D mro Sunday, December 5, 2010
  • 148. Method Resolution Order A - 5.8 : D, B, A, C - 5.10: D, B, C, A B C D mro Sunday, December 5, 2010
  • 149. Method Resolution Order A - 5.8 : D, B, A, C - 5.10: D, B, C, A B C - 5.12: Anything! D mro Sunday, December 5, 2010
  • 150. Method Resolution Order A - 5.8 : D, B, A, C - 5.10: D, B, C, A B C - 5.12: F D MRO::Define Sunday, December 5, 2010
  • 151. use strict; use warnings; package Booster::Gold; our $VERSION = ‘1.00’; ... 1; Sunday, December 5, 2010
  • 152. use 5.12.0; use warnings; package Booster::Gold 1.00; ... 1; Sunday, December 5, 2010
  • 153. use 5.14.0; use warnings; package Booster::Gold 1.00 { ... } 1; Sunday, December 5, 2010