1 / 17

PERL

PERL. (the language for getting your job done) Internet Programming Diana Hingst. WHAT IS PERL?. Dynamic programming language Intended to be practical (easy to use & efficient) Widely adopted for its text processing One of “The Three P’s” (Perl, PHP, Python) for writing web applications.

lula
Download Presentation

PERL

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. PERL (the language for getting your job done) Internet Programming Diana Hingst

  2. WHAT IS PERL? • Dynamic programming language • Intended to be practical (easy to use & efficient) • Widely adopted for its text processing • One of “The Three P’s” (Perl, PHP, Python) for writing web applications

  3. Common uses • File system manipulation • Database administration • Client-server programming • Secure programming • Object-oriented programming • GUI development

  4. HISTORY Figure 1: Larry Wall • Created by Larry Wall in 1987 • Designed as a glue for Unix OS • Originally named “PEARL”

  5. THE CAMEL BOOK Figure 2: Programming Perl Cover • First Edition published in 1991 as a reference guide to Perl. • Previously, documentation was a single (very long) man page. • Perl 4 released.

  6. COMPREHENSIVE PERL ARCHIVE NETWORK (cpan) http://www.cpan.org/

  7. Compiled? or interpreted? Answer: Both • Compiles into an intermediate format • Optimizes & gives instant feedback • Interprets the intermediate format to execute

  8. Data types and operators • #Comment • $number = “4”; • $string = “3 apples”; • @array = (“couch”, “movie”, “drink”); • %hash = (joe => ‘red’, sam => ‘blue’); • $a ** $b #a^b • $a . $b #String Concatenation • $a x $b #Repeat a b times

  9. Dynamic typing • $camels = ‘123’; • print $camels + 1; # Prints 124 • $a = “8”; • print $a + “1”; # Prints 9 • print $a . “1”; # Prints 81

  10. Perl basics • Open a text editor • Save with file extension .pl (or .cgi) • We’ve located the PERL interpreter and told it we’re going to be working with a web browser or in a web environment

  11. Perl cgi • Upload it to your web server • Run the program in one of three ways • Link to it • <a href=myscript.cgi>Click Here</a> • Write it into your HTML file • <p><!--#include virtual=“myscript.cgi”--> • Action item of a form • <form action=myscript.cgi> • Unix command line • perl myscript.cgi

  12. Embedded into html script • Perl Code • HTML Code

  13. Security feature • Data Tracing Mechanism • Automatically determines which data was derived from insecure sources • Specially Protected Compartments • Able to safely execute Perl code that may be dangerous/insecure

  14. Practical web uses • Rotate Banners • Generate Text & HTML on the fly • Set Cookies • Provide Shopping Carts

  15. Websites using perl • Amazon.com • LiveJournal.com • Ticketmaster.com • IMDb.com

  16. Perl poetry • Writing poems that can actually be compiled as legal Perl code. if ((light eq dark) && (dark eq light) && ($blaze_of_night{moon} == black_hole) && ($ravens_wing{bright} == $tin{bright})){ my $love = $you = $sin{darkness} + 1; };

  17. references • Programming Perl 2nd Edition • http://websitehelpers.com/perl/ • http://www.tizag.com/perlT/index.php • http://www.linuxjournal.com/article/3394 • http://en.wikipedia.org/wiki/Larry_Wall • http://en.wikipedia.org/wiki/Perl • http://www.foo.be/docs/tpj/issues/vol5_1/tpj0501-0012.html

More Related