Maybe you do not know that ...
Upcoming SlideShare
Loading in...5
×
 

Maybe you do not know that ...

on

  • 1,024 views

koorchik's (Viktor Turskyi) presentation from Black Perl 2011.

koorchik's (Viktor Turskyi) presentation from Black Perl 2011.

Statistics

Views

Total Views
1,024
Views on SlideShare
1,020
Embed Views
4

Actions

Likes
0
Downloads
4
Comments
0

2 Embeds 4

http://paper.li 3
http://a0.twimg.com 1

Accessibility

Categories

Upload Details

Uploaded via as OpenOffice

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Maybe you do not know that ... Maybe you do not know that ... Presentation Transcript

      • Maybe you do not know that ...
    • $dbh->do() or die; $sth->execute() or die; #$sth non select statement
    • So, zero can be true
    • “ 0.0” “ 0E0” “ +0” “ 0”
    • “ 0 but true”
    • perl -wE 'say "0 but true"+5' #5 perl -wE 'say "0 but true!"+5' Argument "0 but true!" isn't numeric in addition (+) at -e line 1. #5
    • local
    • our $l = 5; {local $l = 4; say $l}; say $l; #4 #5
    • my $l = 5; {local $l = 4; say $l}; say $l; #Can't localize lexical variable $l at -e line 2.
    • my $l = { a => 5 }; { local $l->{a} = 4; say $l->{a}; }; say $l->{a}; #4 #5
    • my @l = (2,3,5); { local $l[2] = 4; say $l[2]; }; say $l[2]; #4 #5
    • { local $h->{RaiseError}; ... }
    • One line file slurp
    • $content = do {local(@ARGV, $/) = $f; <ARGV>}
    • perl -e 'while (<ARGV>){ … }' f1 f2 f3
    • @INC
    • use everywhere 'MooseX::Declare', matching => '^MyApp', use_here => 0;
    • @INC hooks Subroutine Array Object perldoc -f require
    • $_
    • my @ar = qw/h e l l o/; foreach (@ar) { do_something(); say $_; }
    • Somewhere in outer space... ... Open (my $fh, '<', 'file') while(<$fh>) { ... } ...
    • my @ar = qw/h e l l o/; foreach (@ar) { do_something(); say $_; #undef } say “@ar”; #array of undefs
    • REGEXP in the wake of hackaton
    • say “test1” =~ /t1/; say “test2” =~ //;
    • say “test1” =~ /t1/; # matched say “test2” =~ //; # not matched
    • $text =~ m/ $re /;
    • $text =~ m/ (?:$re) /;
    • ENV PERL5LIB Is there something else?
    • PERL5OPT export PERL5OPT='-MData::Dumper' perl -e 'print Dumper([1,2])'
    • Try::Tiny
    • Why do we need Try::Tiny Clobbering $@ Localizing $@ silently masks errors $@ might not be a true value Shiny syntax perldoc Try::Tiny
    • Fixed in perl 5.14 Clobbering $@ Localizing $@ silently masks errors Remains $@ might not be a true value Shiny syntax
    • Private accessors/methods
    • my $name = sub { my $self = shift; ... } $self->$name(); $self->$name('viktor');
    • use Sub::Name; my $name = subname name => sub { my $self = shift; ... } $self->$name(); $self->$name('viktor');
    • Word that nobody knows how to pronounce me too :)
    • SUITE
    • SUITE [swi:t]
    • Thank you! Viktor Turskyi (koorchik) http://koorchik.blogspot.com