Mason 2 - July 2011 - Seattle Perl Users Group
Upcoming SlideShare
Loading in...5
×
 

Mason 2 - July 2011 - Seattle Perl Users Group

on

  • 2,554 views

 

Statistics

Views

Total Views
2,554
Views on SlideShare
2,554
Embed Views
0

Actions

Likes
0
Downloads
3
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Apple Keynote

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n

Mason 2 - July 2011 - Seattle Perl Users Group Mason 2 - July 2011 - Seattle Perl Users Group Presentation Transcript

  • Mason 2True OO templating for Perl Jonathan Swartz July 26, 2011 Seattle Perl Users Group
  • What is Mason?Templating system for generating dynamic content(e.g. web pages) <& header.mi &> <ul> % foreach my $article (@articles) { <li> <a href="<% $article->url %>"> <% $article->title %> </a> </li> %} </ul> <& footer.mi &>
  • Mason Timeline• 1998 - HTML::Mason 0.01• 2001 - HTML::Mason 1.0• 2002 - HTML::Mason 1.1, O’Reilly book• - Used by many mod_perl sites• 2006 - Amazon switches to Mason• - The lost years• 2011 - Mason 2.0
  • History: Past 5 years• Mason enters stasis mode• MVC supplants embedded-code• Web frameworks emerge• Catalyst+TT becomes Perl web “standard”• Mason wiki and mail list fills with weeds• Figured I was done... then they drag me back
  • Why Mason 2?• New technologies • Moose • Plack/PSGI• Long-desired syntax and features• Long-standing annoyances• Changes in how people use Mason today
  • Mason 1 vs 2 It’s called... HTML::Mason MasonComponents are... Instances of a class Classes (Moose) Web integration via... mod_perl + glue PSGI Standardized, Filenames are... Arbitrary, unenforced semi-enforced Plugins are... Limited set of hooks Moose roles
  • Components as Moose Classes arguments --> attributes autohandlers --> parent classes “inheritance” --> inheritance subcomponents --> methodscommon package --> distinct packageanon subroutines --> named subroutines Plus the power of Moose (roles, method modifiers, ...)
  • PSGI/Plack• PSGI - Interface spec between Perl web apps and servers (like CGI)• Allows Mason to work from mod_perl, Perl-only server, standalone script...• Plack - Common tools, middleware, servers (debug console, error trace, sessions...)
  • Catalyst/TT vs Mason Separate M Separate M, V, and C Unified V and C Simplified template Perl in templates language Designer friendly Programmer friendly
  • Standard file extensions• .mc - top-level component• .mi - internal component• .mp - pure-perl component
  • Demo
  • More information• http://search.cpan.org/perldoc?Mason• http://www.openswartz.com/