SlideShare a Scribd company logo
WEB DEVELOPMENT IN Perl Naveen Gupta nkrgupta@gmail.com
AGENDA Introduction to Web Development & Perl Perl Powered Sites/Application Basic Web Programming in Perl CGI Programming in Perl Creating HTML Forms mod_perl Templating Systems in Perl Web 2.0 Applications in Perl Perl vs PHP - A Tale of 2 Languages
Introduction to Web Development What is Web Dev?  –  Development of websites, internet applications, e-commerce    sites, social networks etc. –  Includes Web Designing, Content Development, client/server    side coding, Web Server configuration –  Flexible Model, easy to adopt to, Barriers to entry very low –  Contributing Factors - Propagation of Open Source      Technologies, WYSIWYG Tools, Internet Awareness –  Killer Apps – Google Docs, Flickr, WordPress, PhpBB,    WikiMedia, YouTube and millions others
Dominant Technologies C, C++, Pascal, Shell Script ASP JAVA, J2EE and related Frameworks Perl with or without CGI PHP .NET – C#, VB.NET Python Ruby on Rails ColdFusion
Introduction to Perl Created by Larry Wall in 1987 Interpreted, Scripting Language C - like syntax Best of C, awk and sed Best language for Text Manipulation/ Data Processing Swiss Army knife for SysAdmins, Programmers Supports modules, OO, DB interaction, pointers, regular expressions, multithreading, sockets, MVC frameworks Highly Portable, well documented
Perl and the WEB De facto language for CGI Programs Made popular by Matt’s Script Archive Easy to build and maintain Wide acceptance of LAMP framework – Linux, Apache, MySQL, PHP/Perl/Python/Ruby Great DB support via DBI set of Modules Strength of Perl – CPAN,  Comprehensive Perl Archive Network Hands down winner with the advent of mod_perl, FastCGI, Catalyst, Moose etc.
How to get Perl? -   For *NIX Platforms  – Included with almost every Linux, BSD, Solaris, OS X installation. Source can be can be downloaded from  http://www.perl.org  and compiled using  “ gcc”.  RPMs are also available. -  For Windows Platforms  – Installation Binary distributed by  http://www.activestate.com  as  ActivePerl.  Yet, complete LAMP installations distributed by  http:// www.apachefriends.org ,  http://www.apache.org ,  http://www.indigostar.com  etc. are most popular. Complete listing can be found at  http://www.perl.org/ports
Perl Powered Sites/Applications
My First Web Program in Perl #!/usr/bin/perl print  “Content-type:/text/html\n\n”; print  “Hello World!<br>”;
Adding a Bit of `Perl` #!/usr/bin/perl print  “Content-type:/text/html\n\n”; my  $time= localtime ( time ); print  “Today is $time <br>”; foreach my  $key ( sort keys  %ENV){ print qq{$key = $ENV{$key} <br>}; }
Jazz it up with a little HTML #!/usr/bin/perl print  “Content-type:/text/html\n\n”; print  “<h1>Welcome to my First Perl Web page</h1>”; print  “Perl is a great language!<br>”; print  “It can create killer websites too!<br>”; print  “Wanna see how?”;
Here Document #!/usr/bin/perl print  “Content-type:/text/html\n\n”; print <<HTML; <h1>Welcome to my First Perl Web page</h1> Perl is a great language!<br> It can create killer websites too!<br> Wanna see how? HTML
Going Dynamic with CGI #!/usr/bin/perl use  CGI; use  strict; my  $cgi=new CGI; print  $cgi->header(); print  $cgi->start_html(-title=>’First CGI.pm program’, -meta=>{‘keywords’=>’perl cgi’, ‘ copyright’=>’WebOSS ‘07’}, -style=>{‘src’=>’style.css’}, -BGCOLOR=>’blue’); contd….
… contd Going Dynamic with CGI print  $cgi->h1(“Welcome to a CGI APP!”); print  “Your IP Address is : ”.$ENV{‘REMOTE_ADDR’}.“<br>”; print  “You have been directed here from:  $ENV{‘HTTP_REFERER’}” ; print  $cgi->a({-href=>’http://search.cpan.org’,   -target=>’_blank’}, “Go to CPAN!”); print  $cgi->end_html;
The Power of  mod_perl “… mod_perl  is more than CGI scripting on steroids. It is a whole new way to create dynamic content by utilizing the full power of the Apache web server to create stateful sessions, customized user authentication systems, smart proxies and much more. Yet, magically, your old CGI scripts will continue to work and work very fast indeed. With mod_perl you give up nothing and gain so much!  …” – Lincoln Stein, Author – CGI.pm - Perl Interpreter embedded in Apache - Overcomes one-process-per-request limitation of CGI, 100x faster! - Write Apache modules in Perl instead of C - Hundreds of Modules available in CPAN - Numerous Application Frameworks, Templating Systems - Configure Apache’s  httpd.conf  via Perl
Perl Templating Systems HTML::Mason Template Toolkit HTML::Template SSI using mod_include or Apache::SSI module Why use Templating System? Consistency of Appearance Reusability Abstraction between logic and design Division of Labour
Web 2.0 Apps in Perl   CGI::Ajax Object Oriented module by Brian C. Thomas Eliminates the need to write JS for AJAX Calls Generates JS Functions from output by Perl subroutines Can be implemented in large projects HTML::TagCloud Generates Tag Clouds, with different font sizes CSS Based Add method takes 3 arguments – a) Tag Name b) URL to link to c) Weight
WEB DEVELOPMENT IN Perl Perl vs PHP
APACHE INTEGRATION DOCUMENTATION API/ LIBRARY SUPPORT LEARNING CURVE PURPOSE/ UTILITY mod_php mod_perl, Fast CGI http:// www.php.net Perldoc,  http:// perldoc. perl.org  , CPAN PEAR and PECL, both from  http://www.php.net 48606 active modules on CPAN and many others elsewhere Easier than Perl Easier than C, JAVA, .NET Made primarily for WEB. Can do CLI and other tasks. Multi-purpose, primarily for text pocessing, equally suited for sysadmin and web apps PHP Perl
WordPress, phpBB, Drupal, Coppermine, phpMyAdmin AWStats, Slash Code, BugZilla CMS / APPLICATIONS Yes, the main reason for its popularity Only with Modules like Mason, HTML::Template, Template::Toolkit etc. HTML EMBED PHP Perl
THANK YOU! use Perl;
Ad

Recommended

Angularjs PPT
Angularjs PPT
Amit Baghel
 
HTML & CSS Workshop Notes
HTML & CSS Workshop Notes
Pamela Fox
 
Introducing CSS Grid Layout
Introducing CSS Grid Layout
Rachel Andrew
 
ASP.NET Web form
ASP.NET Web form
Md. Mahedee Hasan
 
State management
State management
Lalit Kale
 
AngularJS
AngularJS
Maurice De Beijer [MVP]
 
ASP.NET Lecture 1
ASP.NET Lecture 1
Julie Iskander
 
ASP.NET MVC Presentation
ASP.NET MVC Presentation
ivpol
 
Sharing Data Between Angular Components
Sharing Data Between Angular Components
Squash Apps Pvt Ltd
 
Asp.net state management
Asp.net state management
priya Nithya
 
Internship presentation
Internship presentation
Wasim Shemna
 
TypeScript
TypeScript
Saray Chak
 
Intro to web services
Intro to web services
Neil Ghosh
 
Server Side VS Client Side
Server Side VS Client Side
Code Boxx
 
Javascript Design Patterns
Javascript Design Patterns
Lilia Sfaxi
 
An Introduction To REST API
An Introduction To REST API
Aniruddh Bhilvare
 
Introduction to WAI-ARIA
Introduction to WAI-ARIA
Interactive Accessibility
 
ASP.NET Core MVC + Web API with Overview
ASP.NET Core MVC + Web API with Overview
Shahed Chowdhuri
 
Angular Interview Questions & Answers
Angular Interview Questions & Answers
Ratnala Charan kumar
 
WCF
WCF
Vishwa Mohan
 
Angular 5 presentation for beginners
Angular 5 presentation for beginners
Imran Qasim
 
Communication in a Microservice Architecture
Communication in a Microservice Architecture
Per Bernhardt
 
MVC ppt presentation
MVC ppt presentation
Bhavin Shah
 
Introduction to AngularJS
Introduction to AngularJS
David Parsons
 
AngularJS
AngularJS
NexThoughts Technologies
 
Cucumber ppt
Cucumber ppt
Qwinix Technologies
 
Nuxt.JS Introdruction
Nuxt.JS Introdruction
David Ličen
 
CQRS .NET Conf Chile 2018
CQRS .NET Conf Chile 2018
Germán Küber
 
Mojolicious. The web in a box!
Mojolicious. The web in a box!
Anatoly Sharifulin
 
Perl hosting for beginners - Cluj.pm March 2013
Perl hosting for beginners - Cluj.pm March 2013
Arpad Szasz
 

More Related Content

What's hot (20)

Sharing Data Between Angular Components
Sharing Data Between Angular Components
Squash Apps Pvt Ltd
 
Asp.net state management
Asp.net state management
priya Nithya
 
Internship presentation
Internship presentation
Wasim Shemna
 
TypeScript
TypeScript
Saray Chak
 
Intro to web services
Intro to web services
Neil Ghosh
 
Server Side VS Client Side
Server Side VS Client Side
Code Boxx
 
Javascript Design Patterns
Javascript Design Patterns
Lilia Sfaxi
 
An Introduction To REST API
An Introduction To REST API
Aniruddh Bhilvare
 
Introduction to WAI-ARIA
Introduction to WAI-ARIA
Interactive Accessibility
 
ASP.NET Core MVC + Web API with Overview
ASP.NET Core MVC + Web API with Overview
Shahed Chowdhuri
 
Angular Interview Questions & Answers
Angular Interview Questions & Answers
Ratnala Charan kumar
 
WCF
WCF
Vishwa Mohan
 
Angular 5 presentation for beginners
Angular 5 presentation for beginners
Imran Qasim
 
Communication in a Microservice Architecture
Communication in a Microservice Architecture
Per Bernhardt
 
MVC ppt presentation
MVC ppt presentation
Bhavin Shah
 
Introduction to AngularJS
Introduction to AngularJS
David Parsons
 
AngularJS
AngularJS
NexThoughts Technologies
 
Cucumber ppt
Cucumber ppt
Qwinix Technologies
 
Nuxt.JS Introdruction
Nuxt.JS Introdruction
David Ličen
 
CQRS .NET Conf Chile 2018
CQRS .NET Conf Chile 2018
Germán Küber
 
Sharing Data Between Angular Components
Sharing Data Between Angular Components
Squash Apps Pvt Ltd
 
Asp.net state management
Asp.net state management
priya Nithya
 
Internship presentation
Internship presentation
Wasim Shemna
 
Intro to web services
Intro to web services
Neil Ghosh
 
Server Side VS Client Side
Server Side VS Client Side
Code Boxx
 
Javascript Design Patterns
Javascript Design Patterns
Lilia Sfaxi
 
ASP.NET Core MVC + Web API with Overview
ASP.NET Core MVC + Web API with Overview
Shahed Chowdhuri
 
Angular Interview Questions & Answers
Angular Interview Questions & Answers
Ratnala Charan kumar
 
Angular 5 presentation for beginners
Angular 5 presentation for beginners
Imran Qasim
 
Communication in a Microservice Architecture
Communication in a Microservice Architecture
Per Bernhardt
 
MVC ppt presentation
MVC ppt presentation
Bhavin Shah
 
Introduction to AngularJS
Introduction to AngularJS
David Parsons
 
Nuxt.JS Introdruction
Nuxt.JS Introdruction
David Ličen
 
CQRS .NET Conf Chile 2018
CQRS .NET Conf Chile 2018
Germán Küber
 

Viewers also liked (12)

Mojolicious. The web in a box!
Mojolicious. The web in a box!
Anatoly Sharifulin
 
Perl hosting for beginners - Cluj.pm March 2013
Perl hosting for beginners - Cluj.pm March 2013
Arpad Szasz
 
Web Operations and Perl kansai.pm#14
Web Operations and Perl kansai.pm#14
Masahiro Nagano
 
Modern Web Development with Perl
Modern Web Development with Perl
Dave Cross
 
Modern Web Development with Perl
Modern Web Development with Perl
Dave Cross
 
Introduction to Web Programming with Perl
Introduction to Web Programming with Perl
Dave Cross
 
Modern Perl Catch-Up
Modern Perl Catch-Up
Dave Cross
 
Perl Dancer for Python programmers
Perl Dancer for Python programmers
xSawyer
 
Simple Photo Processing and Web Display with Perl
Simple Photo Processing and Web Display with Perl
Kent Cowgill
 
Plack basics for Perl websites - YAPC::EU 2011
Plack basics for Perl websites - YAPC::EU 2011
leo lapworth
 
How CPAN Testers helped me improve my module
How CPAN Testers helped me improve my module
acme
 
Perl Scripting
Perl Scripting
Varadharajan Mukundan
 
Mojolicious. The web in a box!
Mojolicious. The web in a box!
Anatoly Sharifulin
 
Perl hosting for beginners - Cluj.pm March 2013
Perl hosting for beginners - Cluj.pm March 2013
Arpad Szasz
 
Web Operations and Perl kansai.pm#14
Web Operations and Perl kansai.pm#14
Masahiro Nagano
 
Modern Web Development with Perl
Modern Web Development with Perl
Dave Cross
 
Modern Web Development with Perl
Modern Web Development with Perl
Dave Cross
 
Introduction to Web Programming with Perl
Introduction to Web Programming with Perl
Dave Cross
 
Modern Perl Catch-Up
Modern Perl Catch-Up
Dave Cross
 
Perl Dancer for Python programmers
Perl Dancer for Python programmers
xSawyer
 
Simple Photo Processing and Web Display with Perl
Simple Photo Processing and Web Display with Perl
Kent Cowgill
 
Plack basics for Perl websites - YAPC::EU 2011
Plack basics for Perl websites - YAPC::EU 2011
leo lapworth
 
How CPAN Testers helped me improve my module
How CPAN Testers helped me improve my module
acme
 
Ad

Similar to Web Development in Perl (20)

Building dynamic websites with Mod perl and apache
Building dynamic websites with Mod perl and apache
Kamal Nayan
 
1 Introduction to Drupal Web Development
1 Introduction to Drupal Web Development
Wingston
 
Resume
Resume
Ronald Schmidt
 
Scaleable PHP Applications in Kubernetes
Scaleable PHP Applications in Kubernetes
Robert Lemke
 
Css Founder.com | Cssfounder Net
Css Founder.com | Cssfounder Net
Css Founder
 
Coldfusion
Coldfusion
Ram
 
Google App Engine for PHP
Google App Engine for PHP
Eric Johnson
 
Making Of PHP Based Web Application
Making Of PHP Based Web Application
Sachin Walvekar
 
Chowdhury-webtech.ppt
Chowdhury-webtech.ppt
RonakBothra8
 
Chowdhury-webtech.ppt
Chowdhury-webtech.ppt
ProjectCexsys
 
Chowdhury-webtech.ppt
Chowdhury-webtech.ppt
PunongGrandeNHSBanga
 
Basics of HTML.ppt
Basics of HTML.ppt
handu18
 
Chowdhury-webtech.ppt
Chowdhury-webtech.ppt
AJEETVISHWAKARMA26
 
Hypertext Mark Up Language Introduction.
Hypertext Mark Up Language Introduction.
JohnLagman3
 
Lamp Zend Security
Lamp Zend Security
Ram Srivastava
 
Osp ii presentation
Osp ii presentation
presse_jkp
 
Chowdhury webtech
Chowdhury webtech
Christian Esparagoza
 
Chowdhury webtech
Chowdhury webtech
Microsoft Tech
 
Chowdhury webtech
Chowdhury webtech
karan saini
 
Chowdhury webtech
Chowdhury webtech
Arpit Meena
 
Building dynamic websites with Mod perl and apache
Building dynamic websites with Mod perl and apache
Kamal Nayan
 
1 Introduction to Drupal Web Development
1 Introduction to Drupal Web Development
Wingston
 
Scaleable PHP Applications in Kubernetes
Scaleable PHP Applications in Kubernetes
Robert Lemke
 
Css Founder.com | Cssfounder Net
Css Founder.com | Cssfounder Net
Css Founder
 
Coldfusion
Coldfusion
Ram
 
Google App Engine for PHP
Google App Engine for PHP
Eric Johnson
 
Making Of PHP Based Web Application
Making Of PHP Based Web Application
Sachin Walvekar
 
Chowdhury-webtech.ppt
Chowdhury-webtech.ppt
RonakBothra8
 
Chowdhury-webtech.ppt
Chowdhury-webtech.ppt
ProjectCexsys
 
Basics of HTML.ppt
Basics of HTML.ppt
handu18
 
Hypertext Mark Up Language Introduction.
Hypertext Mark Up Language Introduction.
JohnLagman3
 
Osp ii presentation
Osp ii presentation
presse_jkp
 
Chowdhury webtech
Chowdhury webtech
karan saini
 
Chowdhury webtech
Chowdhury webtech
Arpit Meena
 
Ad

Recently uploaded (20)

“MPU+: A Transformative Solution for Next-Gen AI at the Edge,” a Presentation...
“MPU+: A Transformative Solution for Next-Gen AI at the Edge,” a Presentation...
Edge AI and Vision Alliance
 
From Manual to Auto Searching- FME in the Driver's Seat
From Manual to Auto Searching- FME in the Driver's Seat
Safe Software
 
Securing Account Lifecycles in the Age of Deepfakes.pptx
Securing Account Lifecycles in the Age of Deepfakes.pptx
FIDO Alliance
 
A Constitutional Quagmire - Ethical Minefields of AI, Cyber, and Privacy.pdf
A Constitutional Quagmire - Ethical Minefields of AI, Cyber, and Privacy.pdf
Priyanka Aash
 
Tech-ASan: Two-stage check for Address Sanitizer - Yixuan Cao.pdf
Tech-ASan: Two-stage check for Address Sanitizer - Yixuan Cao.pdf
caoyixuan2019
 
Using the SQLExecutor for Data Quality Management: aka One man's love for the...
Using the SQLExecutor for Data Quality Management: aka One man's love for the...
Safe Software
 
WebdriverIO & JavaScript: The Perfect Duo for Web Automation
WebdriverIO & JavaScript: The Perfect Duo for Web Automation
digitaljignect
 
CapCut Pro Crack For PC Latest Version {Fully Unlocked} 2025
CapCut Pro Crack For PC Latest Version {Fully Unlocked} 2025
pcprocore
 
PyCon SG 25 - Firecracker Made Easy with Python.pdf
PyCon SG 25 - Firecracker Made Easy with Python.pdf
Muhammad Yuga Nugraha
 
9-1-1 Addressing: End-to-End Automation Using FME
9-1-1 Addressing: End-to-End Automation Using FME
Safe Software
 
Salesforce Summer '25 Release Frenchgathering.pptx.pdf
Salesforce Summer '25 Release Frenchgathering.pptx.pdf
yosra Saidani
 
Connecting Data and Intelligence: The Role of FME in Machine Learning
Connecting Data and Intelligence: The Role of FME in Machine Learning
Safe Software
 
Techniques for Automatic Device Identification and Network Assignment.pdf
Techniques for Automatic Device Identification and Network Assignment.pdf
Priyanka Aash
 
Quantum AI: Where Impossible Becomes Probable
Quantum AI: Where Impossible Becomes Probable
Saikat Basu
 
Quantum AI Discoveries: Fractal Patterns Consciousness and Cyclical Universes
Quantum AI Discoveries: Fractal Patterns Consciousness and Cyclical Universes
Saikat Basu
 
The Growing Value and Application of FME & GenAI
The Growing Value and Application of FME & GenAI
Safe Software
 
" How to survive with 1 billion vectors and not sell a kidney: our low-cost c...
" How to survive with 1 billion vectors and not sell a kidney: our low-cost c...
Fwdays
 
Mastering AI Workflows with FME by Mark Döring
Mastering AI Workflows with FME by Mark Döring
Safe Software
 
Hyderabad MuleSoft In-Person Meetup (June 21, 2025) Slides
Hyderabad MuleSoft In-Person Meetup (June 21, 2025) Slides
Ravi Tamada
 
You are not excused! How to avoid security blind spots on the way to production
You are not excused! How to avoid security blind spots on the way to production
Michele Leroux Bustamante
 
“MPU+: A Transformative Solution for Next-Gen AI at the Edge,” a Presentation...
“MPU+: A Transformative Solution for Next-Gen AI at the Edge,” a Presentation...
Edge AI and Vision Alliance
 
From Manual to Auto Searching- FME in the Driver's Seat
From Manual to Auto Searching- FME in the Driver's Seat
Safe Software
 
Securing Account Lifecycles in the Age of Deepfakes.pptx
Securing Account Lifecycles in the Age of Deepfakes.pptx
FIDO Alliance
 
A Constitutional Quagmire - Ethical Minefields of AI, Cyber, and Privacy.pdf
A Constitutional Quagmire - Ethical Minefields of AI, Cyber, and Privacy.pdf
Priyanka Aash
 
Tech-ASan: Two-stage check for Address Sanitizer - Yixuan Cao.pdf
Tech-ASan: Two-stage check for Address Sanitizer - Yixuan Cao.pdf
caoyixuan2019
 
Using the SQLExecutor for Data Quality Management: aka One man's love for the...
Using the SQLExecutor for Data Quality Management: aka One man's love for the...
Safe Software
 
WebdriverIO & JavaScript: The Perfect Duo for Web Automation
WebdriverIO & JavaScript: The Perfect Duo for Web Automation
digitaljignect
 
CapCut Pro Crack For PC Latest Version {Fully Unlocked} 2025
CapCut Pro Crack For PC Latest Version {Fully Unlocked} 2025
pcprocore
 
PyCon SG 25 - Firecracker Made Easy with Python.pdf
PyCon SG 25 - Firecracker Made Easy with Python.pdf
Muhammad Yuga Nugraha
 
9-1-1 Addressing: End-to-End Automation Using FME
9-1-1 Addressing: End-to-End Automation Using FME
Safe Software
 
Salesforce Summer '25 Release Frenchgathering.pptx.pdf
Salesforce Summer '25 Release Frenchgathering.pptx.pdf
yosra Saidani
 
Connecting Data and Intelligence: The Role of FME in Machine Learning
Connecting Data and Intelligence: The Role of FME in Machine Learning
Safe Software
 
Techniques for Automatic Device Identification and Network Assignment.pdf
Techniques for Automatic Device Identification and Network Assignment.pdf
Priyanka Aash
 
Quantum AI: Where Impossible Becomes Probable
Quantum AI: Where Impossible Becomes Probable
Saikat Basu
 
Quantum AI Discoveries: Fractal Patterns Consciousness and Cyclical Universes
Quantum AI Discoveries: Fractal Patterns Consciousness and Cyclical Universes
Saikat Basu
 
The Growing Value and Application of FME & GenAI
The Growing Value and Application of FME & GenAI
Safe Software
 
" How to survive with 1 billion vectors and not sell a kidney: our low-cost c...
" How to survive with 1 billion vectors and not sell a kidney: our low-cost c...
Fwdays
 
Mastering AI Workflows with FME by Mark Döring
Mastering AI Workflows with FME by Mark Döring
Safe Software
 
Hyderabad MuleSoft In-Person Meetup (June 21, 2025) Slides
Hyderabad MuleSoft In-Person Meetup (June 21, 2025) Slides
Ravi Tamada
 
You are not excused! How to avoid security blind spots on the way to production
You are not excused! How to avoid security blind spots on the way to production
Michele Leroux Bustamante
 

Web Development in Perl

  • 2. AGENDA Introduction to Web Development & Perl Perl Powered Sites/Application Basic Web Programming in Perl CGI Programming in Perl Creating HTML Forms mod_perl Templating Systems in Perl Web 2.0 Applications in Perl Perl vs PHP - A Tale of 2 Languages
  • 3. Introduction to Web Development What is Web Dev? – Development of websites, internet applications, e-commerce sites, social networks etc. – Includes Web Designing, Content Development, client/server side coding, Web Server configuration – Flexible Model, easy to adopt to, Barriers to entry very low – Contributing Factors - Propagation of Open Source Technologies, WYSIWYG Tools, Internet Awareness – Killer Apps – Google Docs, Flickr, WordPress, PhpBB, WikiMedia, YouTube and millions others
  • 4. Dominant Technologies C, C++, Pascal, Shell Script ASP JAVA, J2EE and related Frameworks Perl with or without CGI PHP .NET – C#, VB.NET Python Ruby on Rails ColdFusion
  • 5. Introduction to Perl Created by Larry Wall in 1987 Interpreted, Scripting Language C - like syntax Best of C, awk and sed Best language for Text Manipulation/ Data Processing Swiss Army knife for SysAdmins, Programmers Supports modules, OO, DB interaction, pointers, regular expressions, multithreading, sockets, MVC frameworks Highly Portable, well documented
  • 6. Perl and the WEB De facto language for CGI Programs Made popular by Matt’s Script Archive Easy to build and maintain Wide acceptance of LAMP framework – Linux, Apache, MySQL, PHP/Perl/Python/Ruby Great DB support via DBI set of Modules Strength of Perl – CPAN, Comprehensive Perl Archive Network Hands down winner with the advent of mod_perl, FastCGI, Catalyst, Moose etc.
  • 7. How to get Perl? - For *NIX Platforms – Included with almost every Linux, BSD, Solaris, OS X installation. Source can be can be downloaded from http://www.perl.org and compiled using “ gcc”. RPMs are also available. - For Windows Platforms – Installation Binary distributed by http://www.activestate.com as ActivePerl. Yet, complete LAMP installations distributed by http:// www.apachefriends.org , http://www.apache.org , http://www.indigostar.com etc. are most popular. Complete listing can be found at http://www.perl.org/ports
  • 9. My First Web Program in Perl #!/usr/bin/perl print “Content-type:/text/html\n\n”; print “Hello World!<br>”;
  • 10. Adding a Bit of `Perl` #!/usr/bin/perl print “Content-type:/text/html\n\n”; my $time= localtime ( time ); print “Today is $time <br>”; foreach my $key ( sort keys %ENV){ print qq{$key = $ENV{$key} <br>}; }
  • 11. Jazz it up with a little HTML #!/usr/bin/perl print “Content-type:/text/html\n\n”; print “<h1>Welcome to my First Perl Web page</h1>”; print “Perl is a great language!<br>”; print “It can create killer websites too!<br>”; print “Wanna see how?”;
  • 12. Here Document #!/usr/bin/perl print “Content-type:/text/html\n\n”; print <<HTML; <h1>Welcome to my First Perl Web page</h1> Perl is a great language!<br> It can create killer websites too!<br> Wanna see how? HTML
  • 13. Going Dynamic with CGI #!/usr/bin/perl use CGI; use strict; my $cgi=new CGI; print $cgi->header(); print $cgi->start_html(-title=>’First CGI.pm program’, -meta=>{‘keywords’=>’perl cgi’, ‘ copyright’=>’WebOSS ‘07’}, -style=>{‘src’=>’style.css’}, -BGCOLOR=>’blue’); contd….
  • 14. … contd Going Dynamic with CGI print $cgi->h1(“Welcome to a CGI APP!”); print “Your IP Address is : ”.$ENV{‘REMOTE_ADDR’}.“<br>”; print “You have been directed here from: $ENV{‘HTTP_REFERER’}” ; print $cgi->a({-href=>’http://search.cpan.org’, -target=>’_blank’}, “Go to CPAN!”); print $cgi->end_html;
  • 15. The Power of mod_perl “… mod_perl  is more than CGI scripting on steroids. It is a whole new way to create dynamic content by utilizing the full power of the Apache web server to create stateful sessions, customized user authentication systems, smart proxies and much more. Yet, magically, your old CGI scripts will continue to work and work very fast indeed. With mod_perl you give up nothing and gain so much! …” – Lincoln Stein, Author – CGI.pm - Perl Interpreter embedded in Apache - Overcomes one-process-per-request limitation of CGI, 100x faster! - Write Apache modules in Perl instead of C - Hundreds of Modules available in CPAN - Numerous Application Frameworks, Templating Systems - Configure Apache’s httpd.conf via Perl
  • 16. Perl Templating Systems HTML::Mason Template Toolkit HTML::Template SSI using mod_include or Apache::SSI module Why use Templating System? Consistency of Appearance Reusability Abstraction between logic and design Division of Labour
  • 17. Web 2.0 Apps in Perl CGI::Ajax Object Oriented module by Brian C. Thomas Eliminates the need to write JS for AJAX Calls Generates JS Functions from output by Perl subroutines Can be implemented in large projects HTML::TagCloud Generates Tag Clouds, with different font sizes CSS Based Add method takes 3 arguments – a) Tag Name b) URL to link to c) Weight
  • 18. WEB DEVELOPMENT IN Perl Perl vs PHP
  • 19. APACHE INTEGRATION DOCUMENTATION API/ LIBRARY SUPPORT LEARNING CURVE PURPOSE/ UTILITY mod_php mod_perl, Fast CGI http:// www.php.net Perldoc, http:// perldoc. perl.org , CPAN PEAR and PECL, both from http://www.php.net 48606 active modules on CPAN and many others elsewhere Easier than Perl Easier than C, JAVA, .NET Made primarily for WEB. Can do CLI and other tasks. Multi-purpose, primarily for text pocessing, equally suited for sysadmin and web apps PHP Perl
  • 20. WordPress, phpBB, Drupal, Coppermine, phpMyAdmin AWStats, Slash Code, BugZilla CMS / APPLICATIONS Yes, the main reason for its popularity Only with Modules like Mason, HTML::Template, Template::Toolkit etc. HTML EMBED PHP Perl
  • 21. THANK YOU! use Perl;