38
008 Regents of the University of Minnesota. All rights reserved. YAPC::NA 2008 June 16-18, 2008

YAPC::NA 2008

  • Upload
    dard

  • View
    33

  • Download
    0

Embed Size (px)

DESCRIPTION

YAPC::NA 2008. June 16-18, 2008. YAPC::NA 2008. What is YAPC? Y et A nother P erl C onvention Talks by module developers and everyday programmers Networking with other perl programmers Perl classes are offered Low cost – staying in the IIT Dorms. YAPC::NA 2008. - PowerPoint PPT Presentation

Citation preview

Page 1: YAPC::NA 2008

©2008 Regents of the University of Minnesota. All rights reserved.

YAPC::NA 2008

June 16-18, 2008

Page 2: YAPC::NA 2008

©2008 Regents of the University of Minnesota. All rights reserved.

YAPC::NA 2008

• What is YAPC?–Yet Another Perl Convention–Talks by module developers and

everyday programmers–Networking with other perl

programmers–Perl classes are offered–Low cost – staying in the IIT Dorms.

Page 3: YAPC::NA 2008

©2008 Regents of the University of Minnesota. All rights reserved.

YAPC::NA 2008

• What talks did we go to?

Page 4: YAPC::NA 2008

©2008 Regents of the University of Minnesota. All rights reserved.

• A post modern object system for Perl 5• Achieving Win32 Platform Equality• An Introduction to Sub::Exporter• Buildbot and Smolder - distributed build and testing• Creation of a Simple Web app using WebApp

Template Toolkit and Class::DBI• DBI-Link 3.0• DBIx::MasterClass• Essential One-liners• Fey(::ORM), YA(F)ORM• Forget shell scripts!• Gluing Together Amazon Web Services with Perl• Handling the Ball of Mud• How To Be A CPAN Tester• HTML::App -- a Framework for Writing Web

Applications• Introducing the Solstice Framework

Movable Type Open Source (MTOS) for the Perl Developer

• Nothing Can Possibly Go Wrong... Again

• PAR + FUSE + PDF• Perl Is unDead• Perl XML Binding framework (PXB)• Perl::Critic and Perl::Tidy, Your guide to better

programming practices.• Reaction: Continuations, components and reflection in

web MVC• Regexp::Common, the next generation.• Scaling Databases with DBIx::Router

Simple Photo Processing and Web Display with Perl• Skimmable Code: Fast to Read, Fast to Change• Testing Data with the Sims• The WebService Specification Schema and LL

libraries• Understanding Malware• What Is Obvious The Fundamentals Of Interface

Design• Why can't we all live in Greenwich Working with and

around timezones.• Why WebGUI

YAPC::NA 2008

• What talks did we go to?

Page 5: YAPC::NA 2008

©2008 Regents of the University of Minnesota. All rights reserved.

YAPC::NA 2008

What did we learn From some of these talks?

Page 6: YAPC::NA 2008

©2008 Regents of the University of Minnesota. All rights reserved.

YAPC::NA 2008

Forget Shell Scripts! – use Sysadm::Install

• cp “foo”, “bar”;

– use Log::Log4perl • Log::Log4perl->easy_init($DEBUG);

– Between these two modules, you get sysadmin type functions and quick and easy logging

– Use PAR::Packer to create a binary if it is useful

Page 7: YAPC::NA 2008

©2008 Regents of the University of Minnesota. All rights reserved.

YAPC::NA 2008

Skimmable Code– Branch for each task

• Copy the project, run the tests, refactor your code, commit, repeat

– Refactor the bad code• Rename, extract, use whitespace, use uppercase

– Look for Red Flags • Deeply nested structures, globals, long

subroutines

Page 8: YAPC::NA 2008

©2008 Regents of the University of Minnesota. All rights reserved.

YAPC::NA 2008

Handling the Ball of Mud– Ball of mud = a system that has no

distinguishable architecture– Consider using a framework – Refactor– Write Tests– Use tools like Perl::Critic and Perl::Tidy to

clean up code and find bugs– Use a bug tracking system

Page 9: YAPC::NA 2008

©2008 Regents of the University of Minnesota. All rights reserved.

YAPC::NA 2008

Essential One-liners– Perl has a lot of command line options that make one-

liners easy to write.– -e says to take the Perl code from the next command

line, and not STDIN– -l adds a newline to each print statement.– -n puts ‘while(<>){ … }’ around your code– -p prints every line on the input– perl -ne 'print if 10..20' # prints lines 10-20

Page 10: YAPC::NA 2008

©2008 Regents of the University of Minnesota. All rights reserved.

YAPC::NA 2008

PAR + FUSE + PDF– PAR is an archiver like Tar or Jar. Par::Packer

can be used to create a system specific binary program

– FUSE is a filesystem creation module– PDF is literally Portable DATA Format– Combine the three and you have a single file

that when executed mounts a read/write filesystem on your machine.

Page 11: YAPC::NA 2008

©2008 Regents of the University of Minnesota. All rights reserved.

YAPC::NA 2008

Testing with the Sims– Find the atomic data fields (a first name is a text field,

etc.)– Write a function to output valid random data for the

fields.– Make an object with the random data– Write tests for that object– Make complex data structures.– Make the Data more interesting (add unicode,

numbers, symbols)– Can set the random seed to get reproducible tests

Page 12: YAPC::NA 2008

©2008 Regents of the University of Minnesota. All rights reserved.

YAPC::NA 2008

Testing with the Sims– my @Texts = ( "Basset hounds got long ears","Oodles of poodles jump der strudel","I woke up, handcuffed to the bus stop, again",

);

sub rand_text { return $Texts[rand @Texts]; } – our $Seed = $ENV{TEST_SIMS_SEED} || (time ^ $$); srand $Seed; END { print "# TEST_SIMS_SEED=$Seed\n" }

Page 13: YAPC::NA 2008

©2008 Regents of the University of Minnesota. All rights reserved.

YAPC::NA 2008

Regexp::Common, the next generation.– New release to take advantage of perl 5.10– Named Captures are possible– The base class Regexp::Common will not

have patterns (instead load things like Regexp::Common::Net)

– Module is in progress, and will likely change from what we were shown.

Page 14: YAPC::NA 2008

©2008 Regents of the University of Minnesota. All rights reserved.

YAPC::NA 2008

Understanding Malware– Determine the type of malware you are

looking for• Viruses, Trojans, Spyware, Malicious links,

Phishing attacks, Spam

– Determine what to look for• Headers, addresses, key words, attachments,

archives, multiple file extensions, whitelists

– Determine what to do• Delete it, report it, add to heuristic database,

modify an existing filter

Page 15: YAPC::NA 2008

©2008 Regents of the University of Minnesota. All rights reserved.

YAPC::NA 2008

Perl is unDead– Perception is that Perl is dead– Perl is no longer unique (Ruby, Python, PHP)– Perl has some issues still

• The Perl community doesn’t mix well with others.• Most Perl programs don’t install like a PHP app ...• Perl owned Web 1.0 but missed Web 2.0

– What we can do• Collaborate on projects outside Perl• Try out other installers like Wordpress

Page 16: YAPC::NA 2008

©2008 Regents of the University of Minnesota. All rights reserved.

YAPC::NA 2008

Fey(::ORM), YA(F)ORM– ORM (Object Relational Mapping) = a technique for converting

data between relational databases and OO languages.

– Fey is a tool written in Perl for representing a schema as objects

– Fey::ORM is an ORM built on top of the Fey core and Fey::DBIManager.

– Features • SQL oriented ORM (thinking in sets not objects) • Subclasses Moose metaclasses

– Works with SQLite, Pg, and MySQL

Page 17: YAPC::NA 2008

©2008 Regents of the University of Minnesota. All rights reserved.

YAPC::NA 2008

Scaling Databases with DBIx::Router– A system for managing multiple databases – Features

• Load balancing, Failover, Sharding, Transparent

– For fast caching uses DBI::Gopher • A scalable stateless proxy architecture for DBI • Used by shopzilla.com and petfinder.com

– Coming soon to CPAN

Page 18: YAPC::NA 2008

©2008 Regents of the University of Minnesota. All rights reserved.

YAPC::NA 2008

Moose– A postmodern object system for Perl 5– Build on top of Class::MOP– Workarounds the Moose overhead

• Use lazy• Use immutable classes

– Use it for persistent environments– Use it with Perl 5.10 and higher– Class::Accessor messes up your ISA– Mouse = a stripped down version of Moose

Page 19: YAPC::NA 2008

©2008 Regents of the University of Minnesota. All rights reserved.

YAPC::NA 2008

Working with and around timezones– Timezones are complicated

• Indiana is in two time zones• China all in one time zone

– Always use eval (DateTime dies if error)– Use Jifty::DBI::Filter::Date– Daylight saving time (DST) is a mess!– Use Date::Manip for data manipulation routines– Use Date::Extract

• Simple• Doesn't know what a Julian date is• Returns a DateTime object

Page 20: YAPC::NA 2008

©2008 Regents of the University of Minnesota. All rights reserved.

YAPC::NA 2008

An Introduction to Sub::Exporter– Exporter.pm

• Is a core module that is called when you do "use Module.pm;"

• Issues– Doesn't allow renaming, you have to use Exporter::Renaming.

– Conflicts for methods with the same name in different imported modules

– Sub::Exporter• Is a sophisticated exporter for custom build routines• Does renaming in a more elegant way• Does custom imports

Page 21: YAPC::NA 2008

©2008 Regents of the University of Minnesota. All rights reserved.

YAPC::NA 2008

Buildbot and Smolder – Buildbot

• automates the compile/test cycle required to validate changes to the project code base.

– Smolder• Web-Based Test Aggregator used to view smoke /

regression tests using Test Anything Protocol (TAP)

• Features– Access to the raw TAP archives– Search interface and graphs– Info is more organized

Page 22: YAPC::NA 2008

©2008 Regents of the University of Minnesota. All rights reserved.

YAPC::NA 2008

Gluing Together Amazon Web Services with Perl– EC2 (Amazon Elastic Compute Cloud)– S3 (Amazon Simple Storage Service)– Amazon Simple DB– SQS(Amazon Simple Queue Service)– Amazon::Bezos

Page 23: YAPC::NA 2008

©2008 Regents of the University of Minnesota. All rights reserved.

YAPC::NA 2008

How to be a CPAN tester– Many distributed testers, multiple platforms,

multiple Perls– Manual testing : CPAN::Reporter– Automated testing: CPAN::YACSmoke– Structured feedback mechanism CPAN

Testers Wiki: cpantest.grango.org– CPAN Tester Reports: cpantesters.perl.org– CPAN Testers Statistics: perl.grango.org

Page 24: YAPC::NA 2008

©2008 Regents of the University of Minnesota. All rights reserved.

YAPC::NA 2008

Why WebGUI?– Open source CMS written in Perl.– Runs on mod_perl– Features

• Consistent user interface• Versioning and workflow systems• E-commerce system• Internationalization features

– Architecture• Built as an app framework• Pluggable architecture

– Built-in apps• Forums, Polls, SQL Reports, Surveys, Search engines, Events

Calendars, FAQs, Articles

– http://webgui.org

Page 25: YAPC::NA 2008

©2008 Regents of the University of Minnesota. All rights reserved.

YAPC::NA 2008

DBIx::MasterClass– A review of DBIx::Class::ResultSet– Virtual views

• Used for complex queries• Used for subselects, unions and stored procedures

– SQL::Translator::Parser::DBIx::Class

Page 26: YAPC::NA 2008

©2008 Regents of the University of Minnesota. All rights reserved.

YAPC::NA 2008

What else did we do?

Page 27: YAPC::NA 2008

©2008 Regents of the University of Minnesota. All rights reserved.

YAPC::NA 2008

BOF’s (Birds Of a Feather)– CGI::Application

• Talked with and learned from other programmers with similar application frameworks as us

• They did a software release while we were there, and continue to maintain it

• They will be creating some startup scripts that are similar to catalysts startup scripts

• Possibly will have a new name soon • Became involved with the development of

CGI::App

Page 28: YAPC::NA 2008

©2008 Regents of the University of Minnesota. All rights reserved.

YAPC::NA 2008

BOF’s (Birds Of a Feather)

–Perl::Critic BOF• Talked with the authors of Perl::Critic,

and gave input on how a config works

• Most of this conversation was out of the scope of two web developers

Page 29: YAPC::NA 2008

©2008 Regents of the University of Minnesota. All rights reserved.

YAPC::NA 2008

• What did we bring home?

Page 30: YAPC::NA 2008

©2008 Regents of the University of Minnesota. All rights reserved.

YAPC::NA 2008

• What did we bring home?– A tie to the CGI::Application Community

Page 31: YAPC::NA 2008

©2008 Regents of the University of Minnesota. All rights reserved.

YAPC::NA 2008

• What did we bring home?– A tie to the CGI::Application Community

– Ideas for writing better code and repairing our current codebase

Page 32: YAPC::NA 2008

©2008 Regents of the University of Minnesota. All rights reserved.

YAPC::NA 2008

• What did we bring home?– A tie to the CGI::Application Community

– Ideas for writing better code and repairing our current codebase

– Testing techniques

Page 33: YAPC::NA 2008

©2008 Regents of the University of Minnesota. All rights reserved.

YAPC::NA 2008

• What did we bring home?– A tie to the CGI::Application Community

– Ideas for writing better code and repairing our current codebase

– Testing techniques

– Tips and tricks

Page 34: YAPC::NA 2008

©2008 Regents of the University of Minnesota. All rights reserved.

YAPC::NA 2008

• What did we bring home?– A tie to the CGI::Application Community

– Ideas for writing better code and repairing our current codebase

– Testing techniques

– Tips and tricks

– Knowledge of new modules that have yet to be released

Page 35: YAPC::NA 2008

©2008 Regents of the University of Minnesota. All rights reserved.

YAPC::NA 2008

• What did we bring home?– A tie to the CGI::Application Community

– Ideas for writing better code and repairing our current codebase

– Testing techniques

– Tips and tricks

– Knowledge of new modules that have yet to be released

– Knowledge of modules that we are not currently using, but may need someday

Page 36: YAPC::NA 2008

©2008 Regents of the University of Minnesota. All rights reserved.

YAPC::NA 2008

• Would you like to be involved?– Bid for YAPC::NA 2010 to be in Minneapolis

– Minneapolis Frozen::Perl 09 – Coming to Campus in Febuary

– Contact Alina, Stephen, or Leonard if you are interested in volunteering for either of these events.

Page 37: YAPC::NA 2008

©2008 Regents of the University of Minnesota. All rights reserved.

YAPC::NA 2008

https://wiki.umn.edu/view/NTS/YAPC2008PresentationNotes

Page 38: YAPC::NA 2008

©2008 Regents of the University of Minnesota. All rights reserved.

The University of Minnesota is an equal opportunity educator and employer. This PowerPoint is available in alternative formats upon request. Direct requests to Leonard Miller at 612-624-2042.

www.umn.edu/oit