SlideShare uma empresa Scribd logo
1 de 31
Baixar para ler offline
Modern Web
Development in Perl
Jason A. Crome
https://crome-plated.com
March 14, 2017 Copyright (C) 2017, Jason A. Crome
What is Perl?
Common Misconceptions
• It’s dead
• It’s dying
• It’s just for sysadmins
• It’s not for real development
• It’s not modern - hasn’t been updated in years
Why the Misconceptions?
• Bad Marketing
• Perl 6
• Matt’s Script Archive
Perl 6
• Sister language to Perl 5, not a successor!
• Poorly marketed as such
• Fantastic language!
• Both functional and procedural
• Thread-safe
Strengths
• Data Munging
• Bioinformatics
• Devops
• Web application development
• MMOs
• Whipuptitude
Weaknesses
• Threading
• Device Drivers
• 3D game development
• Learning curve
Who’s Using Perl?
• ZipRecruiter
• Booking.com
• Craigslist
• Ticketmaster
• Amazon
• BBC
• NASA
• Rent.com
• DuckDuckGo
• IMDB
• CrowdTilt
• ShutterStock
• ServerCentral
• Bank of America
Actively Developed
• 24th version of Perl 5
• 26th version to be released ~June
• One major release every year
• 5.26 will be 8th production release in last 7 years
• Does that seem like a dead language to you?!
What is Modern Perl?
• First-class OO programming
• Great Testing Infrastructure
• Deployment and Configuration Toolchain
• Active user community
• Modern language features
• Modern frameworks
Object Oriented
• Moose
• Moo
• (before that) Overloaded hashes
package Point;
use Moose;
has 'x' => (isa => 'Int', is => 'rw', required => 1);
has 'y' => (isa => 'Int', is => 'rw', required => 1);
sub clear {
my $self = shift;
$self->x(0);
$self->y(0);
}
package Point3D;
use Moose;
extends 'Point';
has 'z' => (isa => 'Int', is => 'rw', required => 1);
after 'clear' => sub {
my $self = shift;
$self->z(0);
};
# hash or hashrefs are ok for the constructor
my $point1 = Point->new(x => 5, y => 7);
my $point2 = Point->new({x => 5, y => 7});
my $point3d = Point3D->new(x => 5, y => 42, z => -5);
Using the Point Class
Roles with Moose
package MyApp::CLI::SetPassword;
use strictures 2;
use MooseX::App::Command;
extends qw( MyApp::CLI );
with qw(
MyApp::Role::CLI::WithPassword
MyApp::Role::CLI::WithUsername
MyApp::Role::CLI::WithUser
);
use MyApp::Module;
sub run ( $self ) {
$self->_say( "Changing password for " . $self->username . '...' );
$self->user->password( $self->password );
$self->user->update;
say "Done!";
}
1;
Testing Infrastructure
• Test2
• Test::Class::Moose
• prove
• Test::Harness
• TAP
Deployment/Configuration
• Plack
• cpanfile
• Carton
• perlbrew
• plenv
Community
• Perl’s greatest strength
• Perl Mongers
• YAPC / TPC
• (Meta)CPAN
MetaCPAN
Modern Language Features/
Tools
• Named Parameters
• XS
• POD
• Perlcritic
• Perltidy
Named Parameters
sub clear( $self ) {
$self->x(0);
$self->y(0);
}
after 'clear' => sub( $self ) {
$self->z(0);
};
sub set( $self, $x, $y, $z) {
$self->x( $x );
$self->y( $y );
$self->z( $z );
}
Modern Frameworks
• ORMs
• Templating Frameworks
• Web App Frameworks
ORMs
• DBI
• Class::DBI
• DBIx::Class
• Rose::DB
DBIx::Class
$user = $schema->resultset('User')->find( { email => $self->email } );
$user = $schema->resultset('User')->create(
{ username => $self->username,
password => $self->password,
email => $self->email,
}
);


my $user_rs = $schema->resultset('User')->search({
email => { like => '%example.com' },
},{
order_by => { username => 'ASC' },
}
);
Templating Frameworks
• HTML::Template
• Mason
• Template Toolkit
• And many, many others…
Web App Frameworks
And now, Dancer2!
Questions?
Thanks!
https://crome-plated.com
jason@crome-plated.com
Sample Code: https://github.com/cromedome/RWD
Slides: https://www.slideshare.net/cromedome/modern-web-
development-in-perl
Bonus 1: Point Class,
Old World Perl
package Point;
sub new {
my ($class, $x, $y) = @_;
my $self = {
x => $x,
y => $y,
};
return bless $self, $class;
}
sub get_x {
return $_[0]->{x};
}
sub set_x {
return $_[0]->{x} = $_[1];
}
sub get_y {
return $_[0]->{y};
}
sub set_y {
return $_[0]->{y} = $_[1];
}
1;

Mais conteúdo relacionado

Destaque

Classement général après journée24 11 12mars
Classement général après journée24 11 12marsClassement général après journée24 11 12mars
Classement général après journée24 11 12mars
cristeljoiris
 

Destaque (14)

Set reforzamiento aula 360 2
Set reforzamiento aula 360 2Set reforzamiento aula 360 2
Set reforzamiento aula 360 2
 
Sediments loads
Sediments loadsSediments loads
Sediments loads
 
Micro teaching
Micro teachingMicro teaching
Micro teaching
 
Classement général après journée24 11 12mars
Classement général après journée24 11 12marsClassement général après journée24 11 12mars
Classement général après journée24 11 12mars
 
How to search the Internet, a guide to save time and effort
How to search the Internet, a guide to save time and effortHow to search the Internet, a guide to save time and effort
How to search the Internet, a guide to save time and effort
 
When worlds Collide: HTML5 Meets the Cloud
When worlds Collide: HTML5 Meets the CloudWhen worlds Collide: HTML5 Meets the Cloud
When worlds Collide: HTML5 Meets the Cloud
 
How to develop modern web application framework
How to develop modern web application frameworkHow to develop modern web application framework
How to develop modern web application framework
 
Google webmaster guide for starters
Google webmaster guide for startersGoogle webmaster guide for starters
Google webmaster guide for starters
 
Calculate your Water Footprint at H2O Conserve
Calculate your Water Footprint at H2O ConserveCalculate your Water Footprint at H2O Conserve
Calculate your Water Footprint at H2O Conserve
 
Bad websites
Bad websitesBad websites
Bad websites
 
The Modern Web, Part 2: HTML5
The Modern Web, Part 2: HTML5The Modern Web, Part 2: HTML5
The Modern Web, Part 2: HTML5
 
Affordable web design
Affordable web designAffordable web design
Affordable web design
 
The Modern Web Part 3: Social Networking
The Modern Web Part 3: Social NetworkingThe Modern Web Part 3: Social Networking
The Modern Web Part 3: Social Networking
 
Internet Search
Internet SearchInternet Search
Internet Search
 

Semelhante a Modern Web Development in Perl

Ein Stall voller Trüffelschweine - (PHP-)Profiling-Tools im Überblick
Ein Stall voller Trüffelschweine - (PHP-)Profiling-Tools im ÜberblickEin Stall voller Trüffelschweine - (PHP-)Profiling-Tools im Überblick
Ein Stall voller Trüffelschweine - (PHP-)Profiling-Tools im Überblick
renebruns
 
DDD on example of Symfony (SfCampUA14)
DDD on example of Symfony (SfCampUA14)DDD on example of Symfony (SfCampUA14)
DDD on example of Symfony (SfCampUA14)
Oleg Zinchenko
 

Semelhante a Modern Web Development in Perl (20)

Deploying Machine Learning Models to Production
Deploying Machine Learning Models to ProductionDeploying Machine Learning Models to Production
Deploying Machine Learning Models to Production
 
Building Atlassian Plugins with Groovy - Atlassian Summit 2010 - Lightning Talks
Building Atlassian Plugins with Groovy - Atlassian Summit 2010 - Lightning TalksBuilding Atlassian Plugins with Groovy - Atlassian Summit 2010 - Lightning Talks
Building Atlassian Plugins with Groovy - Atlassian Summit 2010 - Lightning Talks
 
React Native Evening
React Native EveningReact Native Evening
React Native Evening
 
Retaining globally distributed high availability
Retaining globally distributed high availabilityRetaining globally distributed high availability
Retaining globally distributed high availability
 
ES2015のカバレッジ計測
ES2015のカバレッジ計測ES2015のカバレッジ計測
ES2015のカバレッジ計測
 
Perl basics for pentesters part 2
Perl basics for pentesters part 2Perl basics for pentesters part 2
Perl basics for pentesters part 2
 
Intro to React
Intro to ReactIntro to React
Intro to React
 
Charla EHU Noviembre 2014 - Desarrollo Web
Charla EHU Noviembre 2014 - Desarrollo WebCharla EHU Noviembre 2014 - Desarrollo Web
Charla EHU Noviembre 2014 - Desarrollo Web
 
Vulnerabilities of machine learning infrastructure
Vulnerabilities of machine learning infrastructureVulnerabilities of machine learning infrastructure
Vulnerabilities of machine learning infrastructure
 
Ein Stall voller Trüffelschweine - (PHP-)Profiling-Tools im Überblick
Ein Stall voller Trüffelschweine - (PHP-)Profiling-Tools im ÜberblickEin Stall voller Trüffelschweine - (PHP-)Profiling-Tools im Überblick
Ein Stall voller Trüffelschweine - (PHP-)Profiling-Tools im Überblick
 
Understanding & analyzing obfuscated malicious web scripts by Vikram Kharvi
Understanding & analyzing obfuscated malicious web scripts by Vikram KharviUnderstanding & analyzing obfuscated malicious web scripts by Vikram Kharvi
Understanding & analyzing obfuscated malicious web scripts by Vikram Kharvi
 
Perl6 meets JVM
Perl6 meets JVMPerl6 meets JVM
Perl6 meets JVM
 
WebCamp: Developer Day: DDD in PHP on example of Symfony - Олег Зинченко
WebCamp: Developer Day: DDD in PHP on example of Symfony - Олег ЗинченкоWebCamp: Developer Day: DDD in PHP on example of Symfony - Олег Зинченко
WebCamp: Developer Day: DDD in PHP on example of Symfony - Олег Зинченко
 
2009-02 Oops!
2009-02 Oops!2009-02 Oops!
2009-02 Oops!
 
Hack the Future
Hack the FutureHack the Future
Hack the Future
 
OWASP Poland Day 2018 - Pedro Fortuna - Are your Java Script based protection...
OWASP Poland Day 2018 - Pedro Fortuna - Are your Java Script based protection...OWASP Poland Day 2018 - Pedro Fortuna - Are your Java Script based protection...
OWASP Poland Day 2018 - Pedro Fortuna - Are your Java Script based protection...
 
frontend college edulink kenia
frontend college edulink kenia frontend college edulink kenia
frontend college edulink kenia
 
DDD on example of Symfony (SfCampUA14)
DDD on example of Symfony (SfCampUA14)DDD on example of Symfony (SfCampUA14)
DDD on example of Symfony (SfCampUA14)
 
Our Puppet Story (GUUG FFG 2015)
Our Puppet Story (GUUG FFG 2015)Our Puppet Story (GUUG FFG 2015)
Our Puppet Story (GUUG FFG 2015)
 
Functional Programming in Clojure
Functional Programming in ClojureFunctional Programming in Clojure
Functional Programming in Clojure
 

Último

Último (20)

What need to be mastered as AI-Powered Java Developers
What need to be mastered as AI-Powered Java DevelopersWhat need to be mastered as AI-Powered Java Developers
What need to be mastered as AI-Powered Java Developers
 
Microsoft365_Dev_Security_2024_05_16.pdf
Microsoft365_Dev_Security_2024_05_16.pdfMicrosoft365_Dev_Security_2024_05_16.pdf
Microsoft365_Dev_Security_2024_05_16.pdf
 
Reinforcement Learning – a Rewards Based Approach to Machine Learning - Marko...
Reinforcement Learning – a Rewards Based Approach to Machine Learning - Marko...Reinforcement Learning – a Rewards Based Approach to Machine Learning - Marko...
Reinforcement Learning – a Rewards Based Approach to Machine Learning - Marko...
 
Sourcing Success - How to Find a Clothing Manufacturer
Sourcing Success - How to Find a Clothing ManufacturerSourcing Success - How to Find a Clothing Manufacturer
Sourcing Success - How to Find a Clothing Manufacturer
 
INGKA DIGITAL: Linked Metadata by Design
INGKA DIGITAL: Linked Metadata by DesignINGKA DIGITAL: Linked Metadata by Design
INGKA DIGITAL: Linked Metadata by Design
 
how-to-download-files-safely-from-the-internet.pdf
how-to-download-files-safely-from-the-internet.pdfhow-to-download-files-safely-from-the-internet.pdf
how-to-download-files-safely-from-the-internet.pdf
 
Secure Software Ecosystem Teqnation 2024
Secure Software Ecosystem Teqnation 2024Secure Software Ecosystem Teqnation 2024
Secure Software Ecosystem Teqnation 2024
 
Anypoint Code Builder - Munich MuleSoft Meetup - 16th May 2024
Anypoint Code Builder - Munich MuleSoft Meetup - 16th May 2024Anypoint Code Builder - Munich MuleSoft Meetup - 16th May 2024
Anypoint Code Builder - Munich MuleSoft Meetup - 16th May 2024
 
Implementing KPIs and Right Metrics for Agile Delivery Teams.pdf
Implementing KPIs and Right Metrics for Agile Delivery Teams.pdfImplementing KPIs and Right Metrics for Agile Delivery Teams.pdf
Implementing KPIs and Right Metrics for Agile Delivery Teams.pdf
 
Entropy, Software Quality, and Innovation (presented at Princeton Plasma Phys...
Entropy, Software Quality, and Innovation (presented at Princeton Plasma Phys...Entropy, Software Quality, and Innovation (presented at Princeton Plasma Phys...
Entropy, Software Quality, and Innovation (presented at Princeton Plasma Phys...
 
The Strategic Impact of Buying vs Building in Test Automation
The Strategic Impact of Buying vs Building in Test AutomationThe Strategic Impact of Buying vs Building in Test Automation
The Strategic Impact of Buying vs Building in Test Automation
 
StrimziCon 2024 - Transition to Apache Kafka on Kubernetes with Strimzi.pdf
StrimziCon 2024 - Transition to Apache Kafka on Kubernetes with Strimzi.pdfStrimziCon 2024 - Transition to Apache Kafka on Kubernetes with Strimzi.pdf
StrimziCon 2024 - Transition to Apache Kafka on Kubernetes with Strimzi.pdf
 
5 Reasons Driving Warehouse Management Systems Demand
5 Reasons Driving Warehouse Management Systems Demand5 Reasons Driving Warehouse Management Systems Demand
5 Reasons Driving Warehouse Management Systems Demand
 
Wired_2.0_CREATE YOUR ULTIMATE LEARNING ENVIRONMENT_JCON_16052024
Wired_2.0_CREATE YOUR ULTIMATE LEARNING ENVIRONMENT_JCON_16052024Wired_2.0_CREATE YOUR ULTIMATE LEARNING ENVIRONMENT_JCON_16052024
Wired_2.0_CREATE YOUR ULTIMATE LEARNING ENVIRONMENT_JCON_16052024
 
Community is Just as Important as Code by Andrea Goulet
Community is Just as Important as Code by Andrea GouletCommunity is Just as Important as Code by Andrea Goulet
Community is Just as Important as Code by Andrea Goulet
 
A Guideline to Zendesk to Re:amaze Data Migration
A Guideline to Zendesk to Re:amaze Data MigrationA Guideline to Zendesk to Re:amaze Data Migration
A Guideline to Zendesk to Re:amaze Data Migration
 
Automate your OpenSIPS config tests - OpenSIPS Summit 2024
Automate your OpenSIPS config tests - OpenSIPS Summit 2024Automate your OpenSIPS config tests - OpenSIPS Summit 2024
Automate your OpenSIPS config tests - OpenSIPS Summit 2024
 
Tree in the Forest - Managing Details in BDD Scenarios (live2test 2024)
Tree in the Forest - Managing Details in BDD Scenarios (live2test 2024)Tree in the Forest - Managing Details in BDD Scenarios (live2test 2024)
Tree in the Forest - Managing Details in BDD Scenarios (live2test 2024)
 
Workforce Efficiency with Employee Time Tracking Software.pdf
Workforce Efficiency with Employee Time Tracking Software.pdfWorkforce Efficiency with Employee Time Tracking Software.pdf
Workforce Efficiency with Employee Time Tracking Software.pdf
 
OpenChain Webinar: AboutCode and Beyond - End-to-End SCA
OpenChain Webinar: AboutCode and Beyond - End-to-End SCAOpenChain Webinar: AboutCode and Beyond - End-to-End SCA
OpenChain Webinar: AboutCode and Beyond - End-to-End SCA
 

Modern Web Development in Perl