Presentation is loading. Please wait.

Presentation is loading. Please wait.

Copyright 2007 Byrne Reese. Distributed under Creative Commons, share and share alike with attribution. Intermediate Perl Programming Class Five Instructor:

Similar presentations


Presentation on theme: "Copyright 2007 Byrne Reese. Distributed under Creative Commons, share and share alike with attribution. Intermediate Perl Programming Class Five Instructor:"— Presentation transcript:

1 Copyright 2007 Byrne Reese. Distributed under Creative Commons, share and share alike with attribution. Intermediate Perl Programming Class Five Instructor: Byrne Reese X401

2 Copyright 2007 Byrne Reese. Distributed under Creative Commons, share and share alike with attribution. Review from Last Week… SQL Primer DBI Overview

3 Copyright 2007 Byrne Reese. Distributed under Creative Commons, share and share alike with attribution. Today’s Agenda Review Homework Class Wrap Up Introduction to XML XML::Simple

4 Copyright 2007 Byrne Reese. Distributed under Creative Commons, share and share alike with attribution. Homework Create an address book: –Write subroutines capable of creating, reading, updating and deleting (CRUD) a single row in the database Extra Credit: –Make it command line accessible

5 Copyright 2007 Byrne Reese. Distributed under Creative Commons, share and share alike with attribution. Class Wrap Up What separates beginners, intermediates and experts? How did everyone do? What did I learn? Feedback –UC Contact: Melody Wells

6 Copyright 2007 Byrne Reese. Distributed under Creative Commons, share and share alike with attribution. XML

7 Copyright 2007 Byrne Reese. Distributed under Creative Commons, share and share alike with attribution. XML Primer eXtensible Markup Language Why use XML? –It’s Simple –It’s Extensible –It’s a Standard –It’s Descriptive –It’s Describable

8 Copyright 2007 Byrne Reese. Distributed under Creative Commons, share and share alike with attribution. XML in the Real World Web Services –Amazon –eBay –PayPal –Salesforce.com Blogs –Atom and RSS Feedburner Google Maps

9 Copyright 2007 Byrne Reese. Distributed under Creative Commons, share and share alike with attribution. XML Syntax and Parsers XML Syntax –Elements –Attributes –Types –Schemas –Well Formed-ness vs. Valid XML Parsers –DOM –SAX

10 Copyright 2007 Byrne Reese. Distributed under Creative Commons, share and share alike with attribution. Sample XML File Example: intperl.xml: Intermediate Perl Byrne Reese 18:30Z-09:00 Paul Elaine Vladimir

11 Copyright 2007 Byrne Reese. Distributed under Creative Commons, share and share alike with attribution. XML Modules XML::Parser XML::SAX XML::Simple

12 Copyright 2007 Byrne Reese. Distributed under Creative Commons, share and share alike with attribution. XML::Simple How to Read XML #!/usr/bin/perl use XML::Simple; my $xmldata = XMLin(“intperl.xml”); print $xmldata->{students}->{student}->[1];

13 Copyright 2007 Byrne Reese. Distributed under Creative Commons, share and share alike with attribution. XML::Simple How to Write XML: #!/usr/bin/perl use XML::Simple; my $xmldata = { name => ‘Intermediate Perl’, instructor => ‘Byrne Reese’, schedule => { time => ’18:30Z-09:00’ }, students => { student => [ ‘Paul’,’Elaine’,’Vladimir’ ] } my $xml = XMLout($xmldata);

14 Copyright 2007 Byrne Reese. Distributed under Creative Commons, share and share alike with attribution. Debugging Data::Dumper –Stringifies Perl data structures Code sample: #!/usr/bin/perl use XML::Simple; use Data::Dumper; my $xmldata = XMLin(“intperl.xml”); print Dumper($xmldata);

15 Copyright 2007 Byrne Reese. Distributed under Creative Commons, share and share alike with attribution. Exercise and Homework In class: parse and display the contents of an RSS feed. –http://www.majordojo.com/index.rdf At home: take a URL to an RSS feed as a command line argument, scrape that page and then display the contents. Hint: “man XML::Simple”

16 Copyright 2007 Byrne Reese. Distributed under Creative Commons, share and share alike with attribution. And now, it’s…


Download ppt "Copyright 2007 Byrne Reese. Distributed under Creative Commons, share and share alike with attribution. Intermediate Perl Programming Class Five Instructor:"

Similar presentations


Ads by Google