As previously announced here, I've been working on a significant update
to CGI::Application focused on Mouse/Moose and PSGI, and also breaking
backwards compatibility in some cases.

What I've published now is in a fairly complete, stable state. Docs are
there are tests are passing.

Still, not all goals are addressed in this early release. Templating
supporting has been removed while the replacement API is determined, and
CGI.pm is still used for the request object, which I plan to replace
eventually.

The code is available on GitHub at the link below, in the
'psgi-application' branch of the CGI--Application repo. The name
"PSGI::Application" can be thought of as a code name, and not a final
name. It's a lousy name because it's too generic terms, so when you
search for it, there's all kinds irrelevant results to compete with.

https://github.com/markstos/CGI--Application/tree/psgi-application

To make the changes from CGI::Application easier to review, I'm
reproducing key parts below as plain text.

What do you think?

#####

COMPATIBILITY WITH CGI::Application

PSGI::Application features a number of differences with
CGI::Application. However, to make it easier to use CGI::Application
projects and plugins with PSGI::Application, we provide
PSGI::Application::Compat, which allows most CGI::Application code and
plugins to be used without modifications.

Here's the list of of differences with CGI::Application.

Official API Changes

* Removed dump() and dump_html

   This functionality is now provided through
   CGI::Application::Plugin::DevPopup. This means the request object is
   no longer expected to have the Dump() and escapeHTML() methods.

* run_as_psgi() is now just run()

   The non-PSGI code path has been removed. This simplifies the
   interface and documentation, while still giving you the flexibility
   to run in all the environments that were previously supported.

* The cgiapp_ prefix is dropped from method names

   The following method names had the cgiapp_ prefix dropped:
   cgiapp_init, cgiapp_prerun, cgiapp_postrun. Also, cgiapp_get_query
   is now "get_request()".

* "<query()"> is now "<req()"> and "new(QUERY=>...)" is now
   "new(REQUEST=>...)"

   This object is primarily used to model an HTTP request. "req()" is a
   common method name for this in other frameworks, providing a measure
   of compatibility.

* Hash keys for new() must now be upper-case now.

   They are case-insensitive previously. That "feature" was rarely
   exercised, but created extra busy-work for plugin authors to be
   consistent.

* The delete() method has been removed.

   This rarely-used method removed params that had been set in the
   object. Removing this method removes state options from the object,
   reducing some kinds of bugs. If you need a read-write data structure
   based on the initial "param()" settings, consider making a copy.

* The default request object has changed from CGI.pm to CGI::PSGI

   In practice, this should work practically the same. The default
   request object may change again in the future to something is more
   PSGI native, generally CGI.pm compatible, but lacks the
   HTML-generation code from CGI.pm. In any case, overriding the
   default can be done in one line of code.

* The default 'start_mode' behavior has changed.

   It now returns a "Hello World" message instead of dumping out
   debugging information. This is usually immediately redefined during
   development and should not be noticeable accept as a first
   impression.

   A new method is available called "default_run_modes" for plugins or
   sub-classes that want to provide an alternate default run mode. For
   example, a debugging plugin that prints diagnostic information, or a
   framework based on this which wants to provide a pretty branded page
   for an enhanced first impression. It won't be used in normal
   development.

   For typical use, these changes have no impact.

* forward() and redirect() are now in the core.

   These are the same methods previously provided by
   CGI::Application::Plugin::Forward and
   CGI::Application::Plugin::Redirect. These common functions are
   available without extra syntax of loading plugins to use them.

* load_tmpl() and html_tmpl_class() have been removed

   PSGI::Application has moved templating support out of the core for
   now. A future release of PSGI::Application will provide or endorse
   an official templating API, while PSGI::Application::Compat will
   continue to provide the removed methods.
   CGI::Application::Plugin::TT provides excellent support for Template
   Toolkit.



#####  CGI::Application community mailing list  ################
##                                                            ##
##  To unsubscribe, or change your message delivery options,  ##
##  visit:  http://www.erlbaum.net/mailman/listinfo/cgiapp    ##
##                                                            ##
##  Web archive:   http://www.erlbaum.net/pipermail/cgiapp/   ##
##  Wiki:          http://cgiapp.erlbaum.net/                 ##
##                                                            ##
################################################################

Reply via email to