Download presentation
Presentation is loading. Please wait.
Published bySherilyn Harvey Modified over 9 years ago
1
Copyright 2007 Byrne Reese. Distributed under Creative Commons, share and share alike with attribution. Intermediate Perl Programming Class One Instructor: Byrne Reese X401
2
Copyright 2007 Byrne Reese. Distributed under Creative Commons, share and share alike with attribution. About the Instructor Byrne Reese –Product Manager, Six Apart –Lead Developer, SOAP::Lite –Perl Hacker and Open Source Junkie Contact Info: –byrne@majordojo.com –AIM: byrnereese –http://www.majordojo.com/
3
Copyright 2007 Byrne Reese. Distributed under Creative Commons, share and share alike with attribution. Intended Audience Anyone interested in taking their basic Perl knowledge to the next step for: –professional use –personal use Someone with a strong grasp of the Perl fundamentals: scalars, lists, arrays, subroutines, etc.
4
Copyright 2007 Byrne Reese. Distributed under Creative Commons, share and share alike with attribution. Objectives Deepen your knowledge and fluency in Perl Learn practical Perl skills Master CPAN and frequently used modules Improve your programming and problem solving skills Learn how to help yourself Learn by doing: –Build and publish web pages –Execute queries against a database –Extract and mine the web for data –Parse XML –Create your own Perl modules
5
Copyright 2007 Byrne Reese. Distributed under Creative Commons, share and share alike with attribution. “Required” Reading Perl Cookbook Second Edition by Tom Christiansen, Nathan Torkington
6
Copyright 2007 Byrne Reese. Distributed under Creative Commons, share and share alike with attribution. Recommended Reading The O’Reilly Perl Series is always a good reference!
7
Copyright 2007 Byrne Reese. Distributed under Creative Commons, share and share alike with attribution. Recommended Reading But O’Reilly is not the only publisher of Perl books!
8
Copyright 2007 Byrne Reese. Distributed under Creative Commons, share and share alike with attribution. Setting Expectations This is an incredibly challenging class –Intensive –Technical This can be a very frustrating class –“Some” system administration required Bottom line: –It takes more than the knowledge of a programming language to make a software engineer.
9
Copyright 2007 Byrne Reese. Distributed under Creative Commons, share and share alike with attribution. Homework and Grades Primary goal of this class: –To learn Your key to success: Engage –Class participation –Homework How your final grade is determined
10
Copyright 2007 Byrne Reese. Distributed under Creative Commons, share and share alike with attribution. Getting Started A Perl Primer
11
Copyright 2007 Byrne Reese. Distributed under Creative Commons, share and share alike with attribution. Your First Program 1.Write the ubiquitous Hello World script 2.Customize it to take a parameterized name to say “hello” to 3.If input is not provided, prompt the user for a name
12
Copyright 2007 Byrne Reese. Distributed under Creative Commons, share and share alike with attribution. Remember… Don’t get overwhelmed by the problem: –Solve the problem in pieces. Don’t be afraid to look online for help! Ask each other questions! Code along with me…
13
Copyright 2007 Byrne Reese. Distributed under Creative Commons, share and share alike with attribution. Hello World #!/usr/bin/perl print “Hello World”;
14
Copyright 2007 Byrne Reese. Distributed under Creative Commons, share and share alike with attribution. Hello World #!/usr/bin/perl my $say_hello_to = $ARGV[0]; $say_hello_to ||= “World”; print “Hello $say_hello_to\n”;
15
Copyright 2007 Byrne Reese. Distributed under Creative Commons, share and share alike with attribution. Hello World #!/usr/bin/perl use Getopt::Long; my $say_hello_to = “World”; GetOptions(“to=s"=>\$say_hello_to); print “Hello $say_hello_to\n”;
16
Copyright 2007 Byrne Reese. Distributed under Creative Commons, share and share alike with attribution. Hello World #!/usr/bin/perl use Getopt::Long; my $say_hello_to = undef; GetOptions(“to=s"=>\$say_hello_to); if (!defined($say_hello_to)) { print “Please enter a name: ”; $say_hello_to = ; chomp $say_hello_to; } print “Hello $say_hello_to\n”;
17
Copyright 2007 Byrne Reese. Distributed under Creative Commons, share and share alike with attribution. Hello World on the Web
18
Copyright 2007 Byrne Reese. Distributed under Creative Commons, share and share alike with attribution. A Few Basics First Setting up your Web server Content Headers File Permissions
19
Copyright 2007 Byrne Reese. Distributed under Creative Commons, share and share alike with attribution. helloworld.cgi #!/usr/bin/perl print “Content-type: text/plain\n\n”; print “Hello World”;
20
Copyright 2007 Byrne Reese. Distributed under Creative Commons, share and share alike with attribution. Perl and the Web Creating a web form – an HTML primer How Perl handles web requests Parsing web form input
21
Copyright 2007 Byrne Reese. Distributed under Creative Commons, share and share alike with attribution. CGI.pm Don’t re-invent the wheel: use a Perl module! Using CGI.pm print header; param(‘say_hello_to’)
22
Copyright 2007 Byrne Reese. Distributed under Creative Commons, share and share alike with attribution. Homework
23
Copyright 2007 Byrne Reese. Distributed under Creative Commons, share and share alike with attribution. Your First Assignment This sounds simple, but… Setup a web server at home, or access Berkeley’s network. Deploy the helloworld.cgi to that web server Make sure it works!
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.