Your SlideShare is downloading. ×
0
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 $artic...
Mason Timeline• 1998 - HTML::Mason 0.01• 2001 - HTML::Mason 1.0• 2002 - HTML::Mason 1.1, O’Reilly book•      - Used by man...
History: Past 5 years• Mason enters stasis mode• MVC supplants embedded-code• Web frameworks emerge• Catalyst+TT becomes P...
Why Mason 2?• New technologies • Moose • Plack/PSGI• Long-desired syntax and features• Long-standing annoyances• Changes i...
Mason 1 vs 2   It’s called...      HTML::Mason              MasonComponents are...    Instances of a class   Classes (Moos...
Components as Moose Classes      arguments    -->   attributes    autohandlers   -->   parent classes   “inheritance”   --...
PSGI/Plack• PSGI - Interface spec between Perl web  apps and servers (like CGI)• Allows Mason to work from mod_perl,  Perl...
Catalyst/TT vs Mason                           Separate M Separate M, V, and C                          Unified V and C Sim...
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/
Upcoming SlideShare
Loading in...5
×

Mason 2 - July 2011 - Seattle Perl Users Group

2,678

Published on

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
2,678
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
4
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • Transcript of "Mason 2 - July 2011 - Seattle Perl Users Group"

    1. 1. Mason 2True OO templating for Perl Jonathan Swartz July 26, 2011 Seattle Perl Users Group
    2. 2. 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 &>
    3. 3. 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
    4. 4. 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
    5. 5. Why Mason 2?• New technologies • Moose • Plack/PSGI• Long-desired syntax and features• Long-standing annoyances• Changes in how people use Mason today
    6. 6. 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
    7. 7. 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, ...)
    8. 8. 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...)
    9. 9. 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
    10. 10. Standard file extensions• .mc - top-level component• .mi - internal component• .mp - pure-perl component
    11. 11. Demo
    12. 12. More information• http://search.cpan.org/perldoc?Mason• http://www.openswartz.com/
    1. A particular slide catching your eye?

      Clipping is a handy way to collect important slides you want to go back to later.

    ×