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
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
“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
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
$[ - 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
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