SlideShare uma empresa Scribd logo
1 de 114
Baixar para ler offline
Matt's
PSGI
Archive
I blame Leo
Lapworth
London.pm
Tech Meet
14th August
Talking
about PSGI
Leo
Mentioned
Matt Wright
I Tweeted
Some
history
1995
Matt's Script
Archive
Most
popular Perl
web site on
the web
Most well-
known Perl
code on the
internet
FormMail
Most widely
installed
Perl program
on the
internet
Most
popular
spamming
tool on the
internet
Terrible
example of
Perl
programming
Popular
!=
Good
People “learn”
Perl from
copying Matt's
code
People learn
“Perl” from
copying Matt's
code
2001
Not Matt's
Scripts
New versions
of
Matt's
scripts
Fewer Bugs
Fewer
Security
Holes
Higher
quality code
Coding
constraints
Targeting
cheap
hosting
plans
1. No CPAN
Modules
2. Perl
5.004_04
(First
version to
include
CGI.pm)
Interesting
challenge
“Interesting”
challenge
Results not
completely
satisfactory
No Template
Toolkit
No Email::*
Not best
practice
(Even for
2001)
2012
NMS looks
embarrassing
Perl web
programming
has changed
a lot
People still
find Matt's
code
People still
“learn”
“Perl” from
Matt's code
Some people
are directed
to nms
project
Not best
practice
Mojolicious
blog posts
Matt
targeted
cheap
hosting
plans
nms
targeted
cheap
hosting
plans
Cheap
hosting
plans are not
CPAN
friendly
Unintended
consequences
nms
discourages
CPAN use
Dilemma
Best
Practice
vs
Easy to
install
Cheap
hosting
plans
still exist
But do their
users still
use
Perl/CGI?
PHP
nms still
exists
So I started
thinking...
Why not...
...rewrite
Matt's
scripts
again?
Using
Modern Perl
Best
Practices
CPAN
PSGI
Dancer
Catalyst
Mojolicious
Web::Simple
Template
Email::*
DBIx::Class
Don't expect
many users
Simple
examples
Solutions to
common
problems
Entry-level
web
programming
in Perl
Some of this
stuff is
ridiculously
easy
text_clock
rand_text
About five
lines of code
Others were
overcomplicated
by Matt's
implementation
guestbook
wwwboard
Both far
easier if you
use a
database
2013
“Let's
remove
CGI.pm from
Perl core”
nms stops
working on
cheap
hosting
Matt's
scripts carry
on working
just fine
(Which is a
little bit
annoying)
When will
those cheap
hosting plans
upgrade to
Perl 5.20?
Probably in
about 15
years
Plenty of
time to get
people used
to PSGI
Simple
examples
look like a
good idea
Progress
report
Github
github.com/davorg/matts-psgi-archive
Four
(simple)
programs
written
countdown
rand_image
rand_text
text_clock
Others to
follow soon
(Probably by
Christmas)
Show us
some code
Remember I
said it was
really easy
rand_text
my $random_file = 'random.txt';
my $delimiter = "%%n";
get '/' => sub {
open my $file, '<', get_file($random_file)
or error $!;
my @phrases;
{
local $/ = $delimiter;
chomp(@phrases = <$file>);
}
my $phrase = @phrases[rand @phrases];
return $phrase;
};
dance;
rand_image
my $img_dir = 'public/img';
get '/' => sub {
opendir my $dir, $img_dir or die $!;
my @imgs = grep { -f "$img_dir/$_" } readdir $dir;
my $img = @imgs[rand @imgs];
return redirect "/img/$img";
};
get '/img/:img' => sub {
return send_file 'img/' . params->{img};
};
dance;
text_clock
use Time::Piece;
get '/' => sub {
return date();
};
sub date {
if (! $Display_Format) {
$Display_Format = build_format();
}
return localtime->strftime($Display_Format);
}
sub build_format {
my @date_fmt;
push @date_fmt, '%A' if $Display_Week_Day;
push @date_fmt, '%B' if $Display_Month;
push @date_fmt, '%d' if $Display_Month_Day;
push @date_fmt, '%Y' if $Display_Year;
push @date_fmt, '%H:%M:%S' if $Display_Time;
push @date_fmt, '%Z' if $Display_Time_Zone;
return join ' ', @date_fmt;
}
github.com/davorg/matts-psgi-archive
Feel free to
submit code
Full
replacements
are good
Patches to
existing
programs
are good
Documentation
is good
Any help
is good
github.com/davorg/matts-psgi-archive
Dave Cross
dave@perlhacks.com
@davorg
Matt's PSGI Archive

Mais conteúdo relacionado

Mais procurados

Coldfusion
ColdfusionColdfusion
Coldfusion
Ram
 
Ratpack - Classy and Compact Groovy Web Apps
Ratpack - Classy and Compact Groovy Web AppsRatpack - Classy and Compact Groovy Web Apps
Ratpack - Classy and Compact Groovy Web Apps
James Williams
 

Mais procurados (20)

Rise of the Machines: PHP and IoT - php[world] 2016
Rise of the Machines: PHP and IoT - php[world] 2016Rise of the Machines: PHP and IoT - php[world] 2016
Rise of the Machines: PHP and IoT - php[world] 2016
 
Coldfusion
ColdfusionColdfusion
Coldfusion
 
Php Dependency Management with Composer ZendCon 2016
Php Dependency Management with Composer ZendCon 2016Php Dependency Management with Composer ZendCon 2016
Php Dependency Management with Composer ZendCon 2016
 
Server Side Swift
Server Side SwiftServer Side Swift
Server Side Swift
 
Laravel and Django and Rails, Oh My!
Laravel and Django and Rails, Oh My!Laravel and Django and Rails, Oh My!
Laravel and Django and Rails, Oh My!
 
Ratpack - Classy and Compact Groovy Web Apps
Ratpack - Classy and Compact Groovy Web AppsRatpack - Classy and Compact Groovy Web Apps
Ratpack - Classy and Compact Groovy Web Apps
 
Swift - Under the Hood
Swift - Under the HoodSwift - Under the Hood
Swift - Under the Hood
 
Internet of Things With PHP
Internet of Things With PHPInternet of Things With PHP
Internet of Things With PHP
 
Building real time applications with Symfony2
Building real time applications with Symfony2Building real time applications with Symfony2
Building real time applications with Symfony2
 
Intro to CakePHP
Intro to CakePHPIntro to CakePHP
Intro to CakePHP
 
Building Web Apps in Ratpack
Building Web Apps in RatpackBuilding Web Apps in Ratpack
Building Web Apps in Ratpack
 
Server Side Swift
Server Side SwiftServer Side Swift
Server Side Swift
 
PHP 5.4 - Begin your love affair with traits
PHP 5.4 - Begin your love affair with traitsPHP 5.4 - Begin your love affair with traits
PHP 5.4 - Begin your love affair with traits
 
Mini .net conf 2020
Mini .net conf 2020Mini .net conf 2020
Mini .net conf 2020
 
Stackato v6
Stackato v6Stackato v6
Stackato v6
 
Re-imaginging CakePHP
Re-imaginging CakePHPRe-imaginging CakePHP
Re-imaginging CakePHP
 
CakePHP - The Path to 2.0
CakePHP - The Path to 2.0CakePHP - The Path to 2.0
CakePHP - The Path to 2.0
 
Perl-Critic
Perl-CriticPerl-Critic
Perl-Critic
 
Ancient To Modern: Upgrading nearly a decade of Plone in public radio
Ancient To Modern: Upgrading nearly a decade of Plone in public radioAncient To Modern: Upgrading nearly a decade of Plone in public radio
Ancient To Modern: Upgrading nearly a decade of Plone in public radio
 
A Brief History of OWIN
A Brief History of OWINA Brief History of OWIN
A Brief History of OWIN
 

Semelhante a Matt's PSGI Archive

[CLPE] Novidades do .net Framework 4.0
[CLPE] Novidades do .net Framework 4.0[CLPE] Novidades do .net Framework 4.0
[CLPE] Novidades do .net Framework 4.0
Felipe Pimentel
 
2013 Tevreden.nl, our Love and Hate of Perl
2013 Tevreden.nl, our Love and Hate of Perl2013 Tevreden.nl, our Love and Hate of Perl
2013 Tevreden.nl, our Love and Hate of Perl
Pascal Vree
 

Semelhante a Matt's PSGI Archive (20)

Matt's PSGI Archive
Matt's PSGI ArchiveMatt's PSGI Archive
Matt's PSGI Archive
 
ITCamp 2018 - Laurent Bugnion - Porting MVVM Light to .NET Standard: Lessons ...
ITCamp 2018 - Laurent Bugnion - Porting MVVM Light to .NET Standard: Lessons ...ITCamp 2018 - Laurent Bugnion - Porting MVVM Light to .NET Standard: Lessons ...
ITCamp 2018 - Laurent Bugnion - Porting MVVM Light to .NET Standard: Lessons ...
 
Molly Holzschlag - FOWD London 2009
Molly Holzschlag - FOWD London 2009Molly Holzschlag - FOWD London 2009
Molly Holzschlag - FOWD London 2009
 
Html5 applications
Html5   applicationsHtml5   applications
Html5 applications
 
The Professional Programmer
The Professional ProgrammerThe Professional Programmer
The Professional Programmer
 
CMs presentation March 2010
CMs presentation March 2010CMs presentation March 2010
CMs presentation March 2010
 
Welsh, Ben: The framework fix: how to build better archives by helping news n...
Welsh, Ben: The framework fix: how to build better archives by helping news n...Welsh, Ben: The framework fix: how to build better archives by helping news n...
Welsh, Ben: The framework fix: how to build better archives by helping news n...
 
NPR API: Create Once Publish Everywhere
NPR API: Create Once Publish EverywhereNPR API: Create Once Publish Everywhere
NPR API: Create Once Publish Everywhere
 
PHP Frameworks, or how I learnt to stop worrying and love the code
PHP Frameworks, or how I learnt to stop worrying and love the codePHP Frameworks, or how I learnt to stop worrying and love the code
PHP Frameworks, or how I learnt to stop worrying and love the code
 
SDLC in Blockchain - Ethereum edition
SDLC in Blockchain - Ethereum editionSDLC in Blockchain - Ethereum edition
SDLC in Blockchain - Ethereum edition
 
Run Fast, Try Not to Break S**t
Run Fast, Try Not to Break S**tRun Fast, Try Not to Break S**t
Run Fast, Try Not to Break S**t
 
Le PERL est mort
Le PERL est mortLe PERL est mort
Le PERL est mort
 
AI and Python: Developing a Conversational Interface using Python
AI and Python: Developing a Conversational Interface using PythonAI and Python: Developing a Conversational Interface using Python
AI and Python: Developing a Conversational Interface using Python
 
[CLPE] Novidades do .net Framework 4.0
[CLPE] Novidades do .net Framework 4.0[CLPE] Novidades do .net Framework 4.0
[CLPE] Novidades do .net Framework 4.0
 
Workshop Trends In Open Source Tech 1 20 10
Workshop Trends In Open Source Tech 1 20 10Workshop Trends In Open Source Tech 1 20 10
Workshop Trends In Open Source Tech 1 20 10
 
2013 Tevreden.nl, our Love and Hate of Perl
2013 Tevreden.nl, our Love and Hate of Perl2013 Tevreden.nl, our Love and Hate of Perl
2013 Tevreden.nl, our Love and Hate of Perl
 
20130202 fosdem love n hateperl latest
20130202 fosdem love n hateperl latest20130202 fosdem love n hateperl latest
20130202 fosdem love n hateperl latest
 
Things we love and hate about Perl @ Tevreden.nl
Things we love and hate about Perl @ Tevreden.nlThings we love and hate about Perl @ Tevreden.nl
Things we love and hate about Perl @ Tevreden.nl
 
Introduction to web design
Introduction to web designIntroduction to web design
Introduction to web design
 
YAPC::EU::2009 - How Opera Software uses Perl
YAPC::EU::2009 - How Opera Software uses PerlYAPC::EU::2009 - How Opera Software uses Perl
YAPC::EU::2009 - How Opera Software uses Perl
 

Mais de Dave Cross

Object-Oriented Programming with Perl and Moose
Object-Oriented Programming with Perl and MooseObject-Oriented Programming with Perl and Moose
Object-Oriented Programming with Perl and Moose
Dave Cross
 
Database Programming with Perl and DBIx::Class
Database Programming with Perl and DBIx::ClassDatabase Programming with Perl and DBIx::Class
Database Programming with Perl and DBIx::Class
Dave Cross
 

Mais de Dave Cross (20)

Measuring the Quality of Your Perl Code
Measuring the Quality of Your Perl CodeMeasuring the Quality of Your Perl Code
Measuring the Quality of Your Perl Code
 
Apollo 11 at 50 - A Simple Twitter Bot
Apollo 11 at 50 - A Simple Twitter BotApollo 11 at 50 - A Simple Twitter Bot
Apollo 11 at 50 - A Simple Twitter Bot
 
Monoliths, Balls of Mud and Silver Bullets
Monoliths, Balls of Mud and Silver BulletsMonoliths, Balls of Mud and Silver Bullets
Monoliths, Balls of Mud and Silver Bullets
 
The Professional Programmer
The Professional ProgrammerThe Professional Programmer
The Professional Programmer
 
I'm A Republic (Honest!)
I'm A Republic (Honest!)I'm A Republic (Honest!)
I'm A Republic (Honest!)
 
Web Site Tune-Up - Improve Your Googlejuice
Web Site Tune-Up - Improve Your GooglejuiceWeb Site Tune-Up - Improve Your Googlejuice
Web Site Tune-Up - Improve Your Googlejuice
 
Modern Perl Web Development with Dancer
Modern Perl Web Development with DancerModern Perl Web Development with Dancer
Modern Perl Web Development with Dancer
 
Freeing Tower Bridge
Freeing Tower BridgeFreeing Tower Bridge
Freeing Tower Bridge
 
Modern Perl Catch-Up
Modern Perl Catch-UpModern Perl Catch-Up
Modern Perl Catch-Up
 
Error(s) Free Programming
Error(s) Free ProgrammingError(s) Free Programming
Error(s) Free Programming
 
Medium Perl
Medium PerlMedium Perl
Medium Perl
 
Improving Dev Assistant
Improving Dev AssistantImproving Dev Assistant
Improving Dev Assistant
 
Conference Driven Publishing
Conference Driven PublishingConference Driven Publishing
Conference Driven Publishing
 
Conference Driven Publishing
Conference Driven PublishingConference Driven Publishing
Conference Driven Publishing
 
TwittElection
TwittElectionTwittElection
TwittElection
 
Perl in the Internet of Things
Perl in the Internet of ThingsPerl in the Internet of Things
Perl in the Internet of Things
 
Return to the Kingdom of the Blind
Return to the Kingdom of the BlindReturn to the Kingdom of the Blind
Return to the Kingdom of the Blind
 
Github, Travis-CI and Perl
Github, Travis-CI and PerlGithub, Travis-CI and Perl
Github, Travis-CI and Perl
 
Object-Oriented Programming with Perl and Moose
Object-Oriented Programming with Perl and MooseObject-Oriented Programming with Perl and Moose
Object-Oriented Programming with Perl and Moose
 
Database Programming with Perl and DBIx::Class
Database Programming with Perl and DBIx::ClassDatabase Programming with Perl and DBIx::Class
Database Programming with Perl and DBIx::Class
 

Último

Último (20)

Using IESVE for Room Loads Analysis - UK & Ireland
Using IESVE for Room Loads Analysis - UK & IrelandUsing IESVE for Room Loads Analysis - UK & Ireland
Using IESVE for Room Loads Analysis - UK & Ireland
 
WebAssembly is Key to Better LLM Performance
WebAssembly is Key to Better LLM PerformanceWebAssembly is Key to Better LLM Performance
WebAssembly is Key to Better LLM Performance
 
Portal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russePortal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russe
 
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
 
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdfThe Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
 
Easier, Faster, and More Powerful – Notes Document Properties Reimagined
Easier, Faster, and More Powerful – Notes Document Properties ReimaginedEasier, Faster, and More Powerful – Notes Document Properties Reimagined
Easier, Faster, and More Powerful – Notes Document Properties Reimagined
 
Google I/O Extended 2024 Warsaw
Google I/O Extended 2024 WarsawGoogle I/O Extended 2024 Warsaw
Google I/O Extended 2024 Warsaw
 
ERP Contender Series: Acumatica vs. Sage Intacct
ERP Contender Series: Acumatica vs. Sage IntacctERP Contender Series: Acumatica vs. Sage Intacct
ERP Contender Series: Acumatica vs. Sage Intacct
 
ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...
ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...
ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...
 
WSO2CONMay2024OpenSourceConferenceDebrief.pptx
WSO2CONMay2024OpenSourceConferenceDebrief.pptxWSO2CONMay2024OpenSourceConferenceDebrief.pptx
WSO2CONMay2024OpenSourceConferenceDebrief.pptx
 
Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...
Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...
Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...
 
1111 ChatGPT Prompts PDF Free Download - Prompts for ChatGPT
1111 ChatGPT Prompts PDF Free Download - Prompts for ChatGPT1111 ChatGPT Prompts PDF Free Download - Prompts for ChatGPT
1111 ChatGPT Prompts PDF Free Download - Prompts for ChatGPT
 
Intro in Product Management - Коротко про професію продакт менеджера
Intro in Product Management - Коротко про професію продакт менеджераIntro in Product Management - Коротко про професію продакт менеджера
Intro in Product Management - Коротко про професію продакт менеджера
 
Where to Learn More About FDO _ Richard at FIDO Alliance.pdf
Where to Learn More About FDO _ Richard at FIDO Alliance.pdfWhere to Learn More About FDO _ Richard at FIDO Alliance.pdf
Where to Learn More About FDO _ Richard at FIDO Alliance.pdf
 
Enterprise Knowledge Graphs - Data Summit 2024
Enterprise Knowledge Graphs - Data Summit 2024Enterprise Knowledge Graphs - Data Summit 2024
Enterprise Knowledge Graphs - Data Summit 2024
 
Overview of Hyperledger Foundation
Overview of Hyperledger FoundationOverview of Hyperledger Foundation
Overview of Hyperledger Foundation
 
IESVE for Early Stage Design and Planning
IESVE for Early Stage Design and PlanningIESVE for Early Stage Design and Planning
IESVE for Early Stage Design and Planning
 
TopCryptoSupers 12thReport OrionX May2024
TopCryptoSupers 12thReport OrionX May2024TopCryptoSupers 12thReport OrionX May2024
TopCryptoSupers 12thReport OrionX May2024
 
The Metaverse: Are We There Yet?
The  Metaverse:    Are   We  There  Yet?The  Metaverse:    Are   We  There  Yet?
The Metaverse: Are We There Yet?
 
How we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdfHow we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdf
 

Matt's PSGI Archive