[cgiapp] CGI::Application status update from the maintainer

Mark Stosberg mark at summersault.com
Sun Sep 9 15:26:53 EDT 2012


Bill,

Thanks for feedback. Responses are below.

On 09/02/2012 01:46 PM, Bill Stephenson wrote:
> Hi Mark,
>
> Nice to hear you're going to move forward with the CAP project.
>
> After reading your comments about CGI.pm, and comments from others
> here, I'm left wondering about a few things.  If you're ditching
> CGI.pm altogether I know that I'll have to as well.
>
> That's not going to be easy for me. I love the simplicity of these
> features:
>
> 	$cgi = new CGI;
> 	print $cgi->param('contact_name');
> 	$cgi->save($FILE);
> 	$cgi = new CGI($FILE);
>
> What will happen to them?
>
> The simple name=value data format used by the save routine is the same
> as the client side data storage in HTML5 (sessionStorage), and I like
> that it's easy to understand and read this format, and that I can use
> it on both ends (client/server) of my apps.

There not yet specific plans for how CGI.pm will be replaced. How do you
use the save/restore feature? I can say that the PSGI environment does
seem a good deal cleaner for dealing with "input". In CGI, the input by
default comes from STDIN (but large content like post requests), and
several environment variables. This makes the process a bit mysterious,
as well as being action-at-distance a source for confusion. For example,
if something has read and consumed STDIN, it may not there again for
something else to read.

With PSGI, the input is explicitly provided through a Perl hashref, and
the body content comes through a standard file handle.

While I haven't seen a implementation save/restore for PSGI request
objects, it strikes me that it would be pleasant to build.

> What will happen to CGI::Session?
>
> These are all simple, and easy, and familiar. Will the new project
> have these, or something similar?

Like CGI.pm, it will continue to exist, but over time I expect I will
quit using it myself and move on to something else.

Plack::Middleware::Session is an obvious choice to consider for this.
I expect I will personally want to use the "Pure SQL" approach to
session storage, so I will need to first write my own storage driver for
it.

I will appreciate moving away from something based on CGI.pm, towards
using another tool that is shared with other frameworks.

http://search.cpan.org/~miyagawa/Plack-Middleware-Session-0.15/lib/Plack/Middleware/Session.pm
https://metacpan.org/module/CGI::Session::Driver::pure_sql

Those who wish to remain with CGI::App / CGI.pm / CGI::Session are
welcome to do so, but will become responsible for more or all of the
maintenance of them.

> As far as I know, Catalyst, Dancer, and Mojolicious do not have the
> "save" and "new from file" routines, they use SQL and a third party
> database engine only. I know this is probably not something that most
> developers would miss, but I think it's pretty handy. I also think
> that it's a good place for beginners to start learning to use a
> framework. One can go a long way creating apps before they need an SQL
> database, and becoming proficient with SQL is expensive. For the apps
> I build it's like swatting a fly with a bulldozer.

I'm personally a big fan of SQL and think the related investment is well
worth it. I find the basics rather comprehenable:

   "INSERT INTO table VALUES", \%values;
   "UPDATE table SET",\%values;
   "DELETE FROM table WHERE id = ",\$id;
   "SELECT * FROM table WHERE id = ",\$id;

( The above syntax works with DBIx::Simple + SQL::Interp, my preferred
access method. )

However, Plack::Middleware::Session does support a file-storage backend:

   https://metacpan.org/module/Plack::Session::Store::File

> Anyway, I also want to thank you for all you've done with CGI.pm and
> other modules I use everyday. I, like so many others, have been
> standing on your shoulders for years, and I want you to know that I
> really do appreciate what you've done for me. If you ever get down to
> the Ozarks all the beer and Skittles are on me!
>
> Kindest Regards,
>
> Bill Stephenson

Thanks!

     Mark


More information about the cgiapp mailing list