SlideShare une entreprise Scribd logo
1  sur  20
Télécharger pour lire hors ligne
Let's create a website!
Let's find an interesting module

●   Go to CPAN
●   Search for something funny in Text::
●   We found Text::UpsideDown
●   It turns text upside down!
●   OMGZ0x0ztrzzzz11!
Text::UpsideDown

    use Text::UpsideDown;
    my $text   = “Hello world!”;
    my $updown = upside_down($text);


●   Okay, that's pretty simple
Installing Dancer
Installing Dancer
Creating the skeleton

●   Dancer installs an app called “dancer”
●   Run it to create a directory structure
●   Pretty default design for free!
Adding code

●   Edit main path in lib/UpsideDown.pm


    # default path
    get '/' => sub {
      # code to run when someone goes
      # to the main page
    };
Adding code

●   Suppose we get user text with a parameter
●   Use Dancer's “params” to reach it
●   If it's called “text”, all we have to do is...
    my $text = params­>{'text'};
●   Then to turn it upside down...
    my $updown = upside_down($text);
What do we have so far?

●   Someone reaches main page
●   We get text and turn it upside down
    use Text::UpsideDown;
    get '/' => sub {
        my $text   = params­>{'text'};
        my $updown = upside_down($text);
        ...
    };
Rendering it

●   Render template “view/index.tt”
●   Send it the original text and the upside down
    template index => {
        text       => $text,
        upsidedown => $updown,
    };
Putting it all together

use Text::UpsideDown;
get '/' => sub {
  my $text = params­>{'text'};
  my $updown = upside_down($text);
  template index => {
    text       => $text,
    upsidedown => $updown,
  };
};
Now the template

●   Edit index.tt file
●   Add a form to send text
●   Add a text input to write the text
●   Display the upside down text
●   Provide a button to submit more text
●   …
●   Profit!
Creating a form

<form method=”post”>
  <!-- stuff goes here -->
</form>
Adding a text input box

<form method=”post”>


<input type=”text” name=”text”
   value=”<% text | html %>” />


</form>
Adding upside down text

<form method=”post”>
<input type=”text” name=”text”
   value=”<% text | html %>” />


<code><% upsidedown | html %></code>


</form>
Add button to submit form

<form method=”post”>
<input type=”text” name=”text”
   value=”<% text | html %>” />
<code><% upsidedown | html %></code>


<input type=”submit” value=”Upside Down!” />


</form>
Hit it!
upsidedown.casa.darkpan.com
Dancer available @ http://perldancer.org

                  Credit:
             Marco Fontani
          (http://darkpan.com)

Contenu connexe

Tendances

Tendances (15)

7. copy2 in Symfony 4
7. copy2 in Symfony 47. copy2 in Symfony 4
7. copy2 in Symfony 4
 
Mojolicious - Perl Framework for the Real-Time Web (Lightning Talk)
Mojolicious - Perl Framework for the Real-Time Web (Lightning Talk)Mojolicious - Perl Framework for the Real-Time Web (Lightning Talk)
Mojolicious - Perl Framework for the Real-Time Web (Lightning Talk)
 
Mojolicious, real-time web framework
Mojolicious, real-time web frameworkMojolicious, real-time web framework
Mojolicious, real-time web framework
 
ARTDM 170 Week 3: Rollovers
ARTDM 170 Week 3: RolloversARTDM 170 Week 3: Rollovers
ARTDM 170 Week 3: Rollovers
 
Mojolicious - A new hope
Mojolicious - A new hopeMojolicious - A new hope
Mojolicious - A new hope
 
Dangerous Goods
Dangerous GoodsDangerous Goods
Dangerous Goods
 
Html tag
Html tagHtml tag
Html tag
 
Mojolicious: what works and what doesn't
Mojolicious: what works and what doesn'tMojolicious: what works and what doesn't
Mojolicious: what works and what doesn't
 
Drawings
DrawingsDrawings
Drawings
 
Water Colour
Water ColourWater Colour
Water Colour
 
Image manipulation in WordPress 3.5
Image manipulation in WordPress 3.5Image manipulation in WordPress 3.5
Image manipulation in WordPress 3.5
 
jQuery basics
jQuery basicsjQuery basics
jQuery basics
 
Haml in 5 minutes
Haml in 5 minutesHaml in 5 minutes
Haml in 5 minutes
 
Lang
LangLang
Lang
 
9. lower in Symfony 4
9. lower in Symfony 49. lower in Symfony 4
9. lower in Symfony 4
 

En vedette

Perl &lt;b>5 Tutorial&lt;/b>, First Edition
Perl &lt;b>5 Tutorial&lt;/b>, First EditionPerl &lt;b>5 Tutorial&lt;/b>, First Edition
Perl &lt;b>5 Tutorial&lt;/b>, First Editiontutorialsruby
 
Perl in the Internet of Things
Perl in the Internet of ThingsPerl in the Internet of Things
Perl in the Internet of ThingsDave Cross
 
Deploying Plack Web Applications: OSCON 2011
Deploying Plack Web Applications: OSCON 2011Deploying Plack Web Applications: OSCON 2011
Deploying Plack Web Applications: OSCON 2011Tatsuhiko Miyagawa
 
Plack basics for Perl websites - YAPC::EU 2011
Plack basics for Perl websites - YAPC::EU 2011Plack basics for Perl websites - YAPC::EU 2011
Plack basics for Perl websites - YAPC::EU 2011leo lapworth
 

En vedette (7)

PSGI/Plack OSDC.TW
PSGI/Plack OSDC.TWPSGI/Plack OSDC.TW
PSGI/Plack OSDC.TW
 
Dancer's Ecosystem
Dancer's EcosystemDancer's Ecosystem
Dancer's Ecosystem
 
Perl &lt;b>5 Tutorial&lt;/b>, First Edition
Perl &lt;b>5 Tutorial&lt;/b>, First EditionPerl &lt;b>5 Tutorial&lt;/b>, First Edition
Perl &lt;b>5 Tutorial&lt;/b>, First Edition
 
Perl in the Internet of Things
Perl in the Internet of ThingsPerl in the Internet of Things
Perl in the Internet of Things
 
Message passing
Message passingMessage passing
Message passing
 
Deploying Plack Web Applications: OSCON 2011
Deploying Plack Web Applications: OSCON 2011Deploying Plack Web Applications: OSCON 2011
Deploying Plack Web Applications: OSCON 2011
 
Plack basics for Perl websites - YAPC::EU 2011
Plack basics for Perl websites - YAPC::EU 2011Plack basics for Perl websites - YAPC::EU 2011
Plack basics for Perl websites - YAPC::EU 2011
 

Similaire à Your first website in under a minute with Dancer

The road to &lt;> styled-components: CSS in component-based systems by Max S...
The road to &lt;> styled-components: CSS in component-based systems by Max S...The road to &lt;> styled-components: CSS in component-based systems by Max S...
The road to &lt;> styled-components: CSS in component-based systems by Max S...React London 2017
 
HTML::FormHandler
HTML::FormHandlerHTML::FormHandler
HTML::FormHandlerbbeeley
 
Cucumber: How I Slice It
Cucumber: How I Slice ItCucumber: How I Slice It
Cucumber: How I Slice Itlinoj
 
PerlDancer for Perlers (FOSDEM 2011)
PerlDancer for Perlers (FOSDEM 2011)PerlDancer for Perlers (FOSDEM 2011)
PerlDancer for Perlers (FOSDEM 2011)xSawyer
 
Perl Dancer for Python programmers
Perl Dancer for Python programmersPerl Dancer for Python programmers
Perl Dancer for Python programmersxSawyer
 
Image Converter script for PNG to JPG & JPG to PNG.pdf
Image Converter script for PNG to JPG & JPG to PNG.pdfImage Converter script for PNG to JPG & JPG to PNG.pdf
Image Converter script for PNG to JPG & JPG to PNG.pdfBe Problem Solver
 
Modern Web Development with Perl
Modern Web Development with PerlModern Web Development with Perl
Modern Web Development with PerlDave Cross
 
Python Code Camp for Professionals 3/4
Python Code Camp for Professionals 3/4Python Code Camp for Professionals 3/4
Python Code Camp for Professionals 3/4DEVCON
 
Type Systems & Props Design - Exploring PropTypes, TypeScript, Flow & Reason
Type Systems & Props Design - Exploring PropTypes, TypeScript, Flow & ReasonType Systems & Props Design - Exploring PropTypes, TypeScript, Flow & Reason
Type Systems & Props Design - Exploring PropTypes, TypeScript, Flow & ReasonNikolaus Graf
 
Refresh Austin - Intro to Dexy
Refresh Austin - Intro to DexyRefresh Austin - Intro to Dexy
Refresh Austin - Intro to Dexyananelson
 
Pgm2_UpgradeReport_FilesUpgradeReport.cssBODY{BACKGRO.docx
Pgm2_UpgradeReport_FilesUpgradeReport.cssBODY{BACKGRO.docxPgm2_UpgradeReport_FilesUpgradeReport.cssBODY{BACKGRO.docx
Pgm2_UpgradeReport_FilesUpgradeReport.cssBODY{BACKGRO.docxmattjtoni51554
 
Mojolicious. Веб в коробке!
Mojolicious. Веб в коробке!Mojolicious. Веб в коробке!
Mojolicious. Веб в коробке!Anatoly Sharifulin
 
WCRI 2015 I18N L10N
WCRI 2015 I18N L10NWCRI 2015 I18N L10N
WCRI 2015 I18N L10NDave McHale
 
Wordpress plugin development from Scratch
Wordpress plugin development from ScratchWordpress plugin development from Scratch
Wordpress plugin development from ScratchOcaka Alfred
 
Supercharged HTML & CSS
Supercharged HTML & CSSSupercharged HTML & CSS
Supercharged HTML & CSSMax Kraszewski
 

Similaire à Your first website in under a minute with Dancer (20)

Day of code
Day of codeDay of code
Day of code
 
The road to &lt;> styled-components: CSS in component-based systems by Max S...
The road to &lt;> styled-components: CSS in component-based systems by Max S...The road to &lt;> styled-components: CSS in component-based systems by Max S...
The road to &lt;> styled-components: CSS in component-based systems by Max S...
 
Ip lab
Ip labIp lab
Ip lab
 
HTML::FormHandler
HTML::FormHandlerHTML::FormHandler
HTML::FormHandler
 
Blog Hacks 2011
Blog Hacks 2011Blog Hacks 2011
Blog Hacks 2011
 
Cucumber: How I Slice It
Cucumber: How I Slice ItCucumber: How I Slice It
Cucumber: How I Slice It
 
PerlDancer for Perlers (FOSDEM 2011)
PerlDancer for Perlers (FOSDEM 2011)PerlDancer for Perlers (FOSDEM 2011)
PerlDancer for Perlers (FOSDEM 2011)
 
Perl Dancer for Python programmers
Perl Dancer for Python programmersPerl Dancer for Python programmers
Perl Dancer for Python programmers
 
Image Converter script for PNG to JPG & JPG to PNG.pdf
Image Converter script for PNG to JPG & JPG to PNG.pdfImage Converter script for PNG to JPG & JPG to PNG.pdf
Image Converter script for PNG to JPG & JPG to PNG.pdf
 
Modern Perl
Modern PerlModern Perl
Modern Perl
 
Modern Web Development with Perl
Modern Web Development with PerlModern Web Development with Perl
Modern Web Development with Perl
 
Python Code Camp for Professionals 3/4
Python Code Camp for Professionals 3/4Python Code Camp for Professionals 3/4
Python Code Camp for Professionals 3/4
 
Type Systems & Props Design - Exploring PropTypes, TypeScript, Flow & Reason
Type Systems & Props Design - Exploring PropTypes, TypeScript, Flow & ReasonType Systems & Props Design - Exploring PropTypes, TypeScript, Flow & Reason
Type Systems & Props Design - Exploring PropTypes, TypeScript, Flow & Reason
 
Refresh Austin - Intro to Dexy
Refresh Austin - Intro to DexyRefresh Austin - Intro to Dexy
Refresh Austin - Intro to Dexy
 
Pgm2_UpgradeReport_FilesUpgradeReport.cssBODY{BACKGRO.docx
Pgm2_UpgradeReport_FilesUpgradeReport.cssBODY{BACKGRO.docxPgm2_UpgradeReport_FilesUpgradeReport.cssBODY{BACKGRO.docx
Pgm2_UpgradeReport_FilesUpgradeReport.cssBODY{BACKGRO.docx
 
Mojolicious. Веб в коробке!
Mojolicious. Веб в коробке!Mojolicious. Веб в коробке!
Mojolicious. Веб в коробке!
 
WCRI 2015 I18N L10N
WCRI 2015 I18N L10NWCRI 2015 I18N L10N
WCRI 2015 I18N L10N
 
Wordpress plugin development from Scratch
Wordpress plugin development from ScratchWordpress plugin development from Scratch
Wordpress plugin development from Scratch
 
Borrador del blog
Borrador del blogBorrador del blog
Borrador del blog
 
Supercharged HTML & CSS
Supercharged HTML & CSSSupercharged HTML & CSS
Supercharged HTML & CSS
 

Plus de xSawyer

do_this and die();
do_this and die();do_this and die();
do_this and die();xSawyer
 
Asynchronous Programming FTW! 2 (with AnyEvent)
Asynchronous Programming FTW! 2 (with AnyEvent)Asynchronous Programming FTW! 2 (with AnyEvent)
Asynchronous Programming FTW! 2 (with AnyEvent)xSawyer
 
Asynchronous programming FTW!
Asynchronous programming FTW!Asynchronous programming FTW!
Asynchronous programming FTW!xSawyer
 
Moose - YAPC::NA 2012
Moose - YAPC::NA 2012Moose - YAPC::NA 2012
Moose - YAPC::NA 2012xSawyer
 
Our local state, my, my - Understanding Perl variables
Our local state, my, my - Understanding Perl variablesOur local state, my, my - Understanding Perl variables
Our local state, my, my - Understanding Perl variablesxSawyer
 
Moose talk at FOSDEM 2011 (Perl devroom)
Moose talk at FOSDEM 2011 (Perl devroom)Moose talk at FOSDEM 2011 (Perl devroom)
Moose talk at FOSDEM 2011 (Perl devroom)xSawyer
 
When Perl Met Android (YAPC::EU 2010)
When Perl Met Android (YAPC::EU 2010)When Perl Met Android (YAPC::EU 2010)
When Perl Met Android (YAPC::EU 2010)xSawyer
 
Perl Dancer on Android (first attempt)
Perl Dancer on Android (first attempt)Perl Dancer on Android (first attempt)
Perl Dancer on Android (first attempt)xSawyer
 
Source Code Management systems
Source Code Management systemsSource Code Management systems
Source Code Management systemsxSawyer
 
Moose (Perl 5)
Moose (Perl 5)Moose (Perl 5)
Moose (Perl 5)xSawyer
 
Red Flags in Programming
Red Flags in ProgrammingRed Flags in Programming
Red Flags in ProgrammingxSawyer
 

Plus de xSawyer (12)

do_this and die();
do_this and die();do_this and die();
do_this and die();
 
XS Fun
XS FunXS Fun
XS Fun
 
Asynchronous Programming FTW! 2 (with AnyEvent)
Asynchronous Programming FTW! 2 (with AnyEvent)Asynchronous Programming FTW! 2 (with AnyEvent)
Asynchronous Programming FTW! 2 (with AnyEvent)
 
Asynchronous programming FTW!
Asynchronous programming FTW!Asynchronous programming FTW!
Asynchronous programming FTW!
 
Moose - YAPC::NA 2012
Moose - YAPC::NA 2012Moose - YAPC::NA 2012
Moose - YAPC::NA 2012
 
Our local state, my, my - Understanding Perl variables
Our local state, my, my - Understanding Perl variablesOur local state, my, my - Understanding Perl variables
Our local state, my, my - Understanding Perl variables
 
Moose talk at FOSDEM 2011 (Perl devroom)
Moose talk at FOSDEM 2011 (Perl devroom)Moose talk at FOSDEM 2011 (Perl devroom)
Moose talk at FOSDEM 2011 (Perl devroom)
 
When Perl Met Android (YAPC::EU 2010)
When Perl Met Android (YAPC::EU 2010)When Perl Met Android (YAPC::EU 2010)
When Perl Met Android (YAPC::EU 2010)
 
Perl Dancer on Android (first attempt)
Perl Dancer on Android (first attempt)Perl Dancer on Android (first attempt)
Perl Dancer on Android (first attempt)
 
Source Code Management systems
Source Code Management systemsSource Code Management systems
Source Code Management systems
 
Moose (Perl 5)
Moose (Perl 5)Moose (Perl 5)
Moose (Perl 5)
 
Red Flags in Programming
Red Flags in ProgrammingRed Flags in Programming
Red Flags in Programming
 

Dernier

Falcon Invoice Discounting: Unlock Your Business Potential
Falcon Invoice Discounting: Unlock Your Business PotentialFalcon Invoice Discounting: Unlock Your Business Potential
Falcon Invoice Discounting: Unlock Your Business PotentialFalcon investment
 
Kalyan Call Girl 98350*37198 Call Girls in Escort service book now
Kalyan Call Girl 98350*37198 Call Girls in Escort service book nowKalyan Call Girl 98350*37198 Call Girls in Escort service book now
Kalyan Call Girl 98350*37198 Call Girls in Escort service book nowranineha57744
 
QSM Chap 10 Service Culture in Tourism and Hospitality Industry.pptx
QSM Chap 10 Service Culture in Tourism and Hospitality Industry.pptxQSM Chap 10 Service Culture in Tourism and Hospitality Industry.pptx
QSM Chap 10 Service Culture in Tourism and Hospitality Industry.pptxDitasDelaCruz
 
Dr. Admir Softic_ presentation_Green Club_ENG.pdf
Dr. Admir Softic_ presentation_Green Club_ENG.pdfDr. Admir Softic_ presentation_Green Club_ENG.pdf
Dr. Admir Softic_ presentation_Green Club_ENG.pdfAdmir Softic
 
Phases of Negotiation .pptx
 Phases of Negotiation .pptx Phases of Negotiation .pptx
Phases of Negotiation .pptxnandhinijagan9867
 
Paradip CALL GIRL❤7091819311❤CALL GIRLS IN ESCORT SERVICE WE ARE PROVIDING
Paradip CALL GIRL❤7091819311❤CALL GIRLS IN ESCORT SERVICE WE ARE PROVIDINGParadip CALL GIRL❤7091819311❤CALL GIRLS IN ESCORT SERVICE WE ARE PROVIDING
Paradip CALL GIRL❤7091819311❤CALL GIRLS IN ESCORT SERVICE WE ARE PROVIDINGpr788182
 
Al Mizhar Dubai Escorts +971561403006 Escorts Service In Al Mizhar
Al Mizhar Dubai Escorts +971561403006 Escorts Service In Al MizharAl Mizhar Dubai Escorts +971561403006 Escorts Service In Al Mizhar
Al Mizhar Dubai Escorts +971561403006 Escorts Service In Al Mizharallensay1
 
Cannabis Legalization World Map: 2024 Updated
Cannabis Legalization World Map: 2024 UpdatedCannabis Legalization World Map: 2024 Updated
Cannabis Legalization World Map: 2024 UpdatedCannaBusinessPlans
 
New 2024 Cannabis Edibles Investor Pitch Deck Template
New 2024 Cannabis Edibles Investor Pitch Deck TemplateNew 2024 Cannabis Edibles Investor Pitch Deck Template
New 2024 Cannabis Edibles Investor Pitch Deck TemplateCannaBusinessPlans
 
Escorts in Nungambakkam Phone 8250092165 Enjoy 24/7 Escort Service Enjoy Your...
Escorts in Nungambakkam Phone 8250092165 Enjoy 24/7 Escort Service Enjoy Your...Escorts in Nungambakkam Phone 8250092165 Enjoy 24/7 Escort Service Enjoy Your...
Escorts in Nungambakkam Phone 8250092165 Enjoy 24/7 Escort Service Enjoy Your...meghakumariji156
 
JAJPUR CALL GIRL ❤ 82729*64427❤ CALL GIRLS IN JAJPUR ESCORTS
JAJPUR CALL GIRL ❤ 82729*64427❤ CALL GIRLS IN JAJPUR  ESCORTSJAJPUR CALL GIRL ❤ 82729*64427❤ CALL GIRLS IN JAJPUR  ESCORTS
JAJPUR CALL GIRL ❤ 82729*64427❤ CALL GIRLS IN JAJPUR ESCORTSkajalroy875762
 
Putting the SPARK into Virtual Training.pptx
Putting the SPARK into Virtual Training.pptxPutting the SPARK into Virtual Training.pptx
Putting the SPARK into Virtual Training.pptxCynthia Clay
 
Marel Q1 2024 Investor Presentation from May 8, 2024
Marel Q1 2024 Investor Presentation from May 8, 2024Marel Q1 2024 Investor Presentation from May 8, 2024
Marel Q1 2024 Investor Presentation from May 8, 2024Marel
 
Challenges and Opportunities: A Qualitative Study on Tax Compliance in Pakistan
Challenges and Opportunities: A Qualitative Study on Tax Compliance in PakistanChallenges and Opportunities: A Qualitative Study on Tax Compliance in Pakistan
Challenges and Opportunities: A Qualitative Study on Tax Compliance in Pakistanvineshkumarsajnani12
 
Jual Obat Aborsi ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan Cytotec
Jual Obat Aborsi ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan CytotecJual Obat Aborsi ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan Cytotec
Jual Obat Aborsi ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan CytotecZurliaSoop
 
Arti Languages Pre Seed Teaser Deck 2024.pdf
Arti Languages Pre Seed Teaser Deck 2024.pdfArti Languages Pre Seed Teaser Deck 2024.pdf
Arti Languages Pre Seed Teaser Deck 2024.pdfwill854175
 
Mckinsey foundation level Handbook for Viewing
Mckinsey foundation level Handbook for ViewingMckinsey foundation level Handbook for Viewing
Mckinsey foundation level Handbook for ViewingNauman Safdar
 
Lucknow Housewife Escorts by Sexy Bhabhi Service 8250092165
Lucknow Housewife Escorts  by Sexy Bhabhi Service 8250092165Lucknow Housewife Escorts  by Sexy Bhabhi Service 8250092165
Lucknow Housewife Escorts by Sexy Bhabhi Service 8250092165meghakumariji156
 

Dernier (20)

Falcon Invoice Discounting: Unlock Your Business Potential
Falcon Invoice Discounting: Unlock Your Business PotentialFalcon Invoice Discounting: Unlock Your Business Potential
Falcon Invoice Discounting: Unlock Your Business Potential
 
WheelTug Short Pitch Deck 2024 | Byond Insights
WheelTug Short Pitch Deck 2024 | Byond InsightsWheelTug Short Pitch Deck 2024 | Byond Insights
WheelTug Short Pitch Deck 2024 | Byond Insights
 
Kalyan Call Girl 98350*37198 Call Girls in Escort service book now
Kalyan Call Girl 98350*37198 Call Girls in Escort service book nowKalyan Call Girl 98350*37198 Call Girls in Escort service book now
Kalyan Call Girl 98350*37198 Call Girls in Escort service book now
 
QSM Chap 10 Service Culture in Tourism and Hospitality Industry.pptx
QSM Chap 10 Service Culture in Tourism and Hospitality Industry.pptxQSM Chap 10 Service Culture in Tourism and Hospitality Industry.pptx
QSM Chap 10 Service Culture in Tourism and Hospitality Industry.pptx
 
Dr. Admir Softic_ presentation_Green Club_ENG.pdf
Dr. Admir Softic_ presentation_Green Club_ENG.pdfDr. Admir Softic_ presentation_Green Club_ENG.pdf
Dr. Admir Softic_ presentation_Green Club_ENG.pdf
 
Phases of Negotiation .pptx
 Phases of Negotiation .pptx Phases of Negotiation .pptx
Phases of Negotiation .pptx
 
HomeRoots Pitch Deck | Investor Insights | April 2024
HomeRoots Pitch Deck | Investor Insights | April 2024HomeRoots Pitch Deck | Investor Insights | April 2024
HomeRoots Pitch Deck | Investor Insights | April 2024
 
Paradip CALL GIRL❤7091819311❤CALL GIRLS IN ESCORT SERVICE WE ARE PROVIDING
Paradip CALL GIRL❤7091819311❤CALL GIRLS IN ESCORT SERVICE WE ARE PROVIDINGParadip CALL GIRL❤7091819311❤CALL GIRLS IN ESCORT SERVICE WE ARE PROVIDING
Paradip CALL GIRL❤7091819311❤CALL GIRLS IN ESCORT SERVICE WE ARE PROVIDING
 
Al Mizhar Dubai Escorts +971561403006 Escorts Service In Al Mizhar
Al Mizhar Dubai Escorts +971561403006 Escorts Service In Al MizharAl Mizhar Dubai Escorts +971561403006 Escorts Service In Al Mizhar
Al Mizhar Dubai Escorts +971561403006 Escorts Service In Al Mizhar
 
Cannabis Legalization World Map: 2024 Updated
Cannabis Legalization World Map: 2024 UpdatedCannabis Legalization World Map: 2024 Updated
Cannabis Legalization World Map: 2024 Updated
 
New 2024 Cannabis Edibles Investor Pitch Deck Template
New 2024 Cannabis Edibles Investor Pitch Deck TemplateNew 2024 Cannabis Edibles Investor Pitch Deck Template
New 2024 Cannabis Edibles Investor Pitch Deck Template
 
Escorts in Nungambakkam Phone 8250092165 Enjoy 24/7 Escort Service Enjoy Your...
Escorts in Nungambakkam Phone 8250092165 Enjoy 24/7 Escort Service Enjoy Your...Escorts in Nungambakkam Phone 8250092165 Enjoy 24/7 Escort Service Enjoy Your...
Escorts in Nungambakkam Phone 8250092165 Enjoy 24/7 Escort Service Enjoy Your...
 
JAJPUR CALL GIRL ❤ 82729*64427❤ CALL GIRLS IN JAJPUR ESCORTS
JAJPUR CALL GIRL ❤ 82729*64427❤ CALL GIRLS IN JAJPUR  ESCORTSJAJPUR CALL GIRL ❤ 82729*64427❤ CALL GIRLS IN JAJPUR  ESCORTS
JAJPUR CALL GIRL ❤ 82729*64427❤ CALL GIRLS IN JAJPUR ESCORTS
 
Putting the SPARK into Virtual Training.pptx
Putting the SPARK into Virtual Training.pptxPutting the SPARK into Virtual Training.pptx
Putting the SPARK into Virtual Training.pptx
 
Marel Q1 2024 Investor Presentation from May 8, 2024
Marel Q1 2024 Investor Presentation from May 8, 2024Marel Q1 2024 Investor Presentation from May 8, 2024
Marel Q1 2024 Investor Presentation from May 8, 2024
 
Challenges and Opportunities: A Qualitative Study on Tax Compliance in Pakistan
Challenges and Opportunities: A Qualitative Study on Tax Compliance in PakistanChallenges and Opportunities: A Qualitative Study on Tax Compliance in Pakistan
Challenges and Opportunities: A Qualitative Study on Tax Compliance in Pakistan
 
Jual Obat Aborsi ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan Cytotec
Jual Obat Aborsi ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan CytotecJual Obat Aborsi ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan Cytotec
Jual Obat Aborsi ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan Cytotec
 
Arti Languages Pre Seed Teaser Deck 2024.pdf
Arti Languages Pre Seed Teaser Deck 2024.pdfArti Languages Pre Seed Teaser Deck 2024.pdf
Arti Languages Pre Seed Teaser Deck 2024.pdf
 
Mckinsey foundation level Handbook for Viewing
Mckinsey foundation level Handbook for ViewingMckinsey foundation level Handbook for Viewing
Mckinsey foundation level Handbook for Viewing
 
Lucknow Housewife Escorts by Sexy Bhabhi Service 8250092165
Lucknow Housewife Escorts  by Sexy Bhabhi Service 8250092165Lucknow Housewife Escorts  by Sexy Bhabhi Service 8250092165
Lucknow Housewife Escorts by Sexy Bhabhi Service 8250092165
 

Your first website in under a minute with Dancer

  • 1. Let's create a website!
  • 2. Let's find an interesting module ● Go to CPAN ● Search for something funny in Text:: ● We found Text::UpsideDown ● It turns text upside down! ● OMGZ0x0ztrzzzz11!
  • 3. Text::UpsideDown use Text::UpsideDown; my $text   = “Hello world!”; my $updown = upside_down($text); ● Okay, that's pretty simple
  • 6. Creating the skeleton ● Dancer installs an app called “dancer” ● Run it to create a directory structure ● Pretty default design for free!
  • 7.
  • 8. Adding code ● Edit main path in lib/UpsideDown.pm # default path get '/' => sub {   # code to run when someone goes   # to the main page };
  • 9. Adding code ● Suppose we get user text with a parameter ● Use Dancer's “params” to reach it ● If it's called “text”, all we have to do is... my $text = params­>{'text'}; ● Then to turn it upside down... my $updown = upside_down($text);
  • 10. What do we have so far? ● Someone reaches main page ● We get text and turn it upside down use Text::UpsideDown; get '/' => sub {     my $text   = params­>{'text'};     my $updown = upside_down($text);     ... };
  • 11. Rendering it ● Render template “view/index.tt” ● Send it the original text and the upside down template index => {     text       => $text,     upsidedown => $updown, };
  • 12. Putting it all together use Text::UpsideDown; get '/' => sub {   my $text = params­>{'text'};   my $updown = upside_down($text);   template index => {     text       => $text,     upsidedown => $updown,   }; };
  • 13. Now the template ● Edit index.tt file ● Add a form to send text ● Add a text input to write the text ● Display the upside down text ● Provide a button to submit more text ● … ● Profit!
  • 14. Creating a form <form method=”post”> <!-- stuff goes here --> </form>
  • 15. Adding a text input box <form method=”post”> <input type=”text” name=”text” value=”<% text | html %>” /> </form>
  • 16. Adding upside down text <form method=”post”> <input type=”text” name=”text” value=”<% text | html %>” /> <code><% upsidedown | html %></code> </form>
  • 17. Add button to submit form <form method=”post”> <input type=”text” name=”text” value=”<% text | html %>” /> <code><% upsidedown | html %></code> <input type=”submit” value=”Upside Down!” /> </form>
  • 20. Dancer available @ http://perldancer.org Credit: Marco Fontani (http://darkpan.com)