Your SlideShare is downloading. ×
Web Development in Perl
Upcoming SlideShare
Loading in...5

Thanks for flagging this SlideShare!

Oops! An error has occurred.

Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Web Development in Perl


Published on

This was my presentation during WebOSS '07, the first Web and Open Source Technology Conference in Kolkata, on 13th October 2007

This was my presentation during WebOSS '07, the first Web and Open Source Technology Conference in Kolkata, on 13th October 2007

Published in: Technology

No Downloads
Total Views
On Slideshare
From Embeds
Number of Embeds
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

No notes for slide


  • 1. WEB DEVELOPMENT IN Perl Naveen Gupta
  • 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 and compiled using “ gcc”. RPMs are also available.
    • - For Windows Platforms – Installation Binary distributed by as ActivePerl. Yet, complete LAMP installations distributed by http:// , , etc. are most popular. Complete listing can be found at
  • 8.
    • Perl Powered Sites/Applications
  • 9.
    • My First Web Program in Perl
    #!/usr/bin/perl print “Content-type:/text/html ”; print “Hello World!<br>”;
  • 10.
    • Adding a Bit of `Perl`
    #!/usr/bin/perl print “Content-type:/text/html ”; 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 ”; 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 ”; 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 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=>’’, -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 –
    • - 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:// Perldoc, http:// perldoc. , CPAN PEAR and PECL, both from 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;