low maintenance perl
 “optimizing for an easy life”

         perrin harkins
          plus three
the fud

“i would never use perl for a large project.”
“perl is unmaintainable.”
“perl is write­only.”
i shouldn't have to tell you this

use strict;
use warnings;
perltidy
know your audience



“code is always read more times than it is 
                 written.”
                andy hunt
choosing a dialect




don't use something complex when 
     something simple will work.
choosing a dialect




don't do things in a magical way when an 
           explicit way will work.
choosing a dialect




don't make your code complex just so you 
        can get a certain syntax.
choosing a dialect

fetch("search.cpan.org") > my @cont;


                is equivalent to

my $scraper = FEAR::API­>fear();
my $page = $scraper­>fetch("search.cpan.org");
push my @cont, $page­>document­>as_string;
choosing a dialect




follow conventions when you can.
choosing a dialect



                which scans faster?

s{foo}{bar}g;

s/foo/bar/g;
choosing a dialect




don't use an obscure language feature 
    when a common one will work.
choosing a dialect



              dragonchild's law:
"if i have to ask if something is possible on 
   perlmonks, i probably should rethink my 
                     design."
obscure features

   “We redesigned the protocol several times until we had a 
              protocol that performed well. However, 
the resulting protocol was too complex and depended on the 
   behavior of Chubby features that were seldom exercised by 
  other applications. We discovered that we were spending an 
  inordinate amount of time debugging obscure corner cases, 
 not only in Bigtable code, but also in Chubby code. Eventually, 
    we scrapped this protocol and moved to a newer simpler 
protocol that depends solely on widely­used Chubby features.”
                    Google Bigtable Paper
obscure features

example of a changing feature:


my $foo = 1 if $bar;
never




formats
never




           punctuation variables


my $text = do { local $/ = undef; <$fh>; };
never




import functions that don't import

   use Catalyst qw/­Debug/;

   use Catalyst ();
never




   function prototypes

sub do_it (&@) {
  blah blah blah
}
never




indirect object syntax

    new Class    #no

    Class­>new() #yes
never




UNIVERSAL::
never




alternative inheritance schemes
never




       re­blessing existing objects

bless, $object, 'Some::Other::Class';
never




objects that aren't hashes

(but maybe Object::InsideOut)
never




overloading
overloading


use Exception::Class 
 qw(MyProject::BadKarma);
  
# in some method, the exception is triggered
MyProject::BadKarma­>throw();
  
# in the caller, we catch it with eval
if ($@ and $@­>isa('MyProject::BadKarma')) {
never




multiple packages in one file
never




source filters
never



      the constant pragma

use constant TEA => 'Darjeeling';
%beverages = (TEA => 1);
  
our $TEA = 'Darjeeling';
%beverages = ($TEA => 1);
never



          tied variables

tie(%h,’SDBM_File’, ’filename’,...);

$h{'foo'} = 1;
rarely




DESTROY methods
rarely




weak references
rarely




AUTOLOAD
rarely




               wantarray


@books = Book­>search(author => $author)
    || die "book not found";
sometimes




  closures
sometimes




 string eval
sometimes




             sub attributes

sub foo : attribute {
sometimes




code references
sometimes




exported subs
sometimes




chained map/grep
sometimes




        ternary operator



my $foo = $bar ? 'yes' : 'no';
sometimes




    $_
questions you might have




 doesn't this take all the fun out of 
           programming?
questions you might have




won't this make your code longer?
questions you might have




   but AUTOLOAD is awesome!
questions you might have




  why don't you just use Java?
beyond the code

●
    configuration management
●
    version control with branches
beyond the code

●
    tests can save your life
●
    Test::Class can save your tests
●
    smolder, 
    http://sourceforge.net/projects/smolder/
thank you!

More Related Content

PDF
Smalltalk on rubinius
PPTX
A Blink Into The Rails Magic
PDF
Advanced Reflection in Pharo
ODP
Screen Scraping with Ruby
ODP
Ruby on Rails
PPT
Ruby Basics
 
PDF
When To Use Ruby On Rails
PDF
Ruby on Rails Presentation
Smalltalk on rubinius
A Blink Into The Rails Magic
Advanced Reflection in Pharo
Screen Scraping with Ruby
Ruby on Rails
Ruby Basics
 
When To Use Ruby On Rails
Ruby on Rails Presentation

What's hot (18)

PDF
Ruby on Rails Presentation
ODP
Add Perl to Your Toolbelt
PDF
Ruby On Rails Introduction
PDF
Mojolicious
PDF
Cucumber & BDD
PPTX
Things that every JavaScript developer should know by Rachel Appel at FrontCo...
PDF
Ruby and Rails by example
PDF
Alessandro (cirpo) Cinelli - Dear JavaScript - Codemotion Berlin 2018
PPT
Javascript Ks
ODP
Regular Expressions: Backtracking, and The Little Engine that Could(n't)?
PDF
WordPress Development in a Modern PHP World
PPTX
Preparing a WordPress Plugin for Translation
PDF
Selenium sandwich-2
KEY
Introducing Ruby
PDF
Ruby on Rails for beginners
PDF
Ruby, Meet iPhone
PDF
Crafting Quality PHP Applications (PHP Joburg Oct 2019)
PDF
Ajaxworld07
Ruby on Rails Presentation
Add Perl to Your Toolbelt
Ruby On Rails Introduction
Mojolicious
Cucumber & BDD
Things that every JavaScript developer should know by Rachel Appel at FrontCo...
Ruby and Rails by example
Alessandro (cirpo) Cinelli - Dear JavaScript - Codemotion Berlin 2018
Javascript Ks
Regular Expressions: Backtracking, and The Little Engine that Could(n't)?
WordPress Development in a Modern PHP World
Preparing a WordPress Plugin for Translation
Selenium sandwich-2
Introducing Ruby
Ruby on Rails for beginners
Ruby, Meet iPhone
Crafting Quality PHP Applications (PHP Joburg Oct 2019)
Ajaxworld07
Ad

Similar to Low-Maintenance Perl (20)

PDF
Low maintenance perl notes
PDF
Perl 101
ODP
Whatsnew in-perl
PDF
Introduction to Writing Readable and Maintainable Perl (YAPC::EU 2011 Version)
PDF
Perl 5.10
PDF
Introduction to writing readable and maintainable Perl
PDF
Our Friends the Utils: A highway traveled by wheels we didn't re-invent.
PDF
Os Harkins
PPT
Dealing with Legacy Perl Code - Peter Scott
PDF
PDF
Care and feeding notes
ODP
Introduction to Modern Perl
PDF
Perl 5.10 for People Who Aren't Totally Insane
PDF
Object Trampoline: Why having not the object you want is what you need.
PDF
Top 10 Perl Performance Tips
ODP
What's new in Perl 5.10?
PDF
Care and Feeding of Large Web Applications
ODP
Modern Perl
ODP
Perl Teach-In (part 1)
ODP
Introducing Modern Perl
Low maintenance perl notes
Perl 101
Whatsnew in-perl
Introduction to Writing Readable and Maintainable Perl (YAPC::EU 2011 Version)
Perl 5.10
Introduction to writing readable and maintainable Perl
Our Friends the Utils: A highway traveled by wheels we didn't re-invent.
Os Harkins
Dealing with Legacy Perl Code - Peter Scott
Care and feeding notes
Introduction to Modern Perl
Perl 5.10 for People Who Aren't Totally Insane
Object Trampoline: Why having not the object you want is what you need.
Top 10 Perl Performance Tips
What's new in Perl 5.10?
Care and Feeding of Large Web Applications
Modern Perl
Perl Teach-In (part 1)
Introducing Modern Perl
Ad

More from Perrin Harkins (9)

PDF
PyGotham 2014 Introduction to Profiling
PDF
Introduction to performance tuning perl web applications
PDF
Scalable talk notes
ODP
Choosing a Web Architecture for Perl
PDF
Building Scalable Websites with Perl
PPT
Efficient Shared Data in Perl
PPT
Choosing a Templating System
PDF
Scaling Databases with DBIx::Router
PDF
The Most Common Template Toolkit Mistake
PyGotham 2014 Introduction to Profiling
Introduction to performance tuning perl web applications
Scalable talk notes
Choosing a Web Architecture for Perl
Building Scalable Websites with Perl
Efficient Shared Data in Perl
Choosing a Templating System
Scaling Databases with DBIx::Router
The Most Common Template Toolkit Mistake

Recently uploaded (20)

PDF
sustainability-14-14877-v2.pddhzftheheeeee
PPTX
Benefits of Physical activity for teenagers.pptx
PDF
Hindi spoken digit analysis for native and non-native speakers
PPT
Module 1.ppt Iot fundamentals and Architecture
PDF
TrustArc Webinar - Click, Consent, Trust: Winning the Privacy Game
PDF
NewMind AI Weekly Chronicles – August ’25 Week III
PDF
A comparative study of natural language inference in Swahili using monolingua...
PDF
Hybrid horned lizard optimization algorithm-aquila optimizer for DC motor
PPTX
observCloud-Native Containerability and monitoring.pptx
PPTX
The various Industrial Revolutions .pptx
PDF
Getting Started with Data Integration: FME Form 101
PPTX
Modernising the Digital Integration Hub
PDF
Univ-Connecticut-ChatGPT-Presentaion.pdf
PDF
Five Habits of High-Impact Board Members
PPTX
Web Crawler for Trend Tracking Gen Z Insights.pptx
PDF
August Patch Tuesday
PDF
A contest of sentiment analysis: k-nearest neighbor versus neural network
PDF
STKI Israel Market Study 2025 version august
PDF
Zenith AI: Advanced Artificial Intelligence
PDF
Microsoft Solutions Partner Drive Digital Transformation with D365.pdf
sustainability-14-14877-v2.pddhzftheheeeee
Benefits of Physical activity for teenagers.pptx
Hindi spoken digit analysis for native and non-native speakers
Module 1.ppt Iot fundamentals and Architecture
TrustArc Webinar - Click, Consent, Trust: Winning the Privacy Game
NewMind AI Weekly Chronicles – August ’25 Week III
A comparative study of natural language inference in Swahili using monolingua...
Hybrid horned lizard optimization algorithm-aquila optimizer for DC motor
observCloud-Native Containerability and monitoring.pptx
The various Industrial Revolutions .pptx
Getting Started with Data Integration: FME Form 101
Modernising the Digital Integration Hub
Univ-Connecticut-ChatGPT-Presentaion.pdf
Five Habits of High-Impact Board Members
Web Crawler for Trend Tracking Gen Z Insights.pptx
August Patch Tuesday
A contest of sentiment analysis: k-nearest neighbor versus neural network
STKI Israel Market Study 2025 version august
Zenith AI: Advanced Artificial Intelligence
Microsoft Solutions Partner Drive Digital Transformation with D365.pdf

Low-Maintenance Perl