CGI::Prototype
What’s this?
It’s a framework for writing page-based CGI applications in Perl in an MVC fashion by subclassing pages. The core of every CGI application seems to be roughly the same:
- Analyze the incoming parameters, cookies, and URLs to determine the state of the application (let’s call this “dispatch”).
- Based on the current state, analyze the incoming parameters to respond to any form submitted (“respond”).
- From there, decide what response page should be generated, and produce it (“render”).
CGI::Prototype creates a Class::Prototyped or Moose engine for doing all this, with the right amount of callback hooks to customize the process. It is biased toward the excellent Template Toolkit for rendering HTML, but any templating system can be chosen instead. Classes become controllers and templates become views, with clean separation of responsibilities, while CGI::Prototype serves as a sort of “archetypal” controller.
Resources
- CGI::Prototype on the CPAN
- The cgi-protoype project on SourceForge.
- Introduction to CGI::Prototype, part one, two and three. You really shouldn’t miss this series.
- The Introduction to CGI::Prototype slides provide a quick but useful overview.
- Prototype Programming for Classless Classes is the article with which CGI::Prototype publicity began.
- A number of additional links can be found in CGI::Prototype::Docs::Resources
- CGI::Prototype Questions and Answers
- The
activate()
method in CGI::Prototype is the module’s pivot point; you can always refer to it to figure out which hooks are available and when they run.
Mailing list
You can join cgi-prototype-users via the web interface. Alternatively, you can subscribe to the gmane.comp.lang.perl.modules.cgi-prototype.user newsgroup at Gmane. Archives are available from both hosts and also at mail-archive.com.