Terrence Brannon | 23 Aug 21:03
Picon
Gravatar

Moose implementation of CGI::Prototype

Randal wants to maintain prototype-based OOP for a Moose-based version 
of CGI::Prototype. I'm wondering if such a Moose class could be as 
simple as:

package CGI::Prototype::Moose;

use Moose;
extends 'Class::Prototyped';

...

1;

Links:
------
* There is a sample prototype OO moose in this test example:
http://github.com/nothingmuch/moose/blob/0bb2cc8a6a2e4b967b5d8efbcf1ab27f5d95e990/t/200_examples/006_example_Protomoose.t

but I dont fancy breaking with the Class::Prototyped API.

* My current fork of CGI::Prototype which uses Moose:
http://github.com/metaperl/perl-module-cgi-prototype/blob/f3c71299cd98de7b4c4d2b291d95623a761db548/lib/CGI/Prototype/Moose.pm

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
Randal L. Schwartz | 23 Aug 21:18
Favicon
Gravatar

Re: Moose implementation of CGI::Prototype

>>>>> "Terrence" == Terrence Brannon <metaperl <at> gmail.com> writes:

Terrence> Randal wants to maintain prototype-based OOP for a Moose-based version 
Terrence> of CGI::Prototype. I'm wondering if such a Moose class could be as 
Terrence> simple as:

Terrence> package CGI::Prototype::Moose;

Terrence> use Moose;
Terrence> extends 'Class::Prototyped';

Not really.  The prototype stuff of Moose is where you want to start, and it
has a different interface.  If you just pulled in Class::Prototyped, you'd
have a lot of potential conflicts, especially around anonymous classes.

--

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn <at> stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
Terrence Brannon | 31 Aug 00:41
Picon

Prototyping CGI versus CGI::Prototype

Randal L. Schwartz wrote:
Not really. The prototype stuff of Moose is where you want to start, and it has a different interface. If you just pulled in Class::Prototyped, you'd have a lot of potential conflicts, especially around anonymous classes.
I see. I'm not trying to anger you, but I would like to re-join our IRC conversation. If you read the CGIP docs, it speaks of 'the prototypical cgi application' -
  • 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").
And while this core exists in all Perl CGI modules, my experience is that the controller of CGIP has captured it best. It prototypes the CGI response cycle quite well.

On the other hand, I've never had a need for prototyped objects when using CGIP - all my usage has basically been class-based and standard OO and I've been pleased with the results.
.

I'd like to petition for a distinct module in the CGIP distro which uses plain moose <http://github.com/metaperl/perl-module-cgi-prototype/tree/master>.
If someone wants to implement something like that protomoose.t, then that could be another module.


Further, I think CGIP would have been better received by the community if the articles had pointed out exactly what prototype objects offer the CGI application development process. Nothing I've seen in the standard  CGIP docs or Linux Magazine article <http://www.stonehenge.com/merlyn/LinuxMag/col56.html> points to something I could not do easily and cleanly with standard Moose (or plain Perl) classes.

For instance my recent perlmonks praise of CGIP <http://www.perlmonks.org/?node_id=786745> showed an example. But that example benefitted from the controller cycle and standard OO dispatch.






------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
cgi-prototype-users mailing list
cgi-prototype-users <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cgi-prototype-users
Randal L. Schwartz | 31 Aug 00:46
Favicon
Gravatar

Re: Prototyping CGI versus CGI::Prototype


The heir apparent to the CGI::Prototype namespace should support
Class::Prototype-styled objects.  Under the licensing terms of CGIP, you're
free to derive whatever you want and call it whatever you want, but please
reserve CGI::Prototype (or names close to it) for something that supports
prototype-inheritance objects.  I have customers that are making use of the
Class::Prototyped features that are not classical class-instance structures,
so any "replacement" of CGIP with something new must be carefully considered.

--

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn <at> stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
Terrence Brannon | 31 Aug 01:02
Picon
Gravatar

Re: Prototyping CGI versus CGI::Prototype


Randal L. Schwartz wrote:
> The heir apparent to the CGI::Prototype namespace should support
> Class::Prototype-styled objects. 
Right. I'm not suggesting an heir apparent. I'm suggesting an additional 
module in the distribution, along with associated test suite.
This module would extend on the other concept of "CGI Prototype" - 
prototyping the CGI process. Not using CGI with prototyped objects.
Also, people tend to look down on modules whose release date is more 
than 6 months old. It starts to look unmaintained.

I dont want to fork and start a separate distro, just add 
CGI::Prototype::Moose to the CGIP distro.
> I have customers that are making use of the
> Class::Prototyped features that are not classical class-instance structures,
> so any "replacement" of CGIP with something new must be carefully considered.
>
>   
right and a toy example exemplifying the need for non classical 
class-instance structures in the standard docs or a magazine article would
help greatly. I did talk to Jason Purdy above his negative CPAN ratings 
review of CGIP <http://cpanratings.perl.org/dist/CGI-Prototype>.

He wrote his 'review' after skimming the docs. Now, I dont think that 
what he did was fair or thoroughly researched, but I think a section in 
the docs like "Why Another Framework" or "How is CGIP Different" would 
go a long way towards stamping out superficial inspection of the module.

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
Randal L. Schwartz | 31 Aug 01:16
Favicon
Gravatar

Re: Prototyping CGI versus CGI::Prototype

>>>>> "Terrence" == Terrence Brannon <metaperl <at> gmail.com> writes:

Terrence> I dont want to fork and start a separate distro, just add
Terrence> CGI::Prototype::Moose to the CGIP distro.

And I'm saying that's the wrong name for that, if it's not about replacing all
of what CGIP already does, including prototype inheritance.  Feel free
to release it as CGI::Moose or something.

--

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn <at> stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july

Gmane