Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

CGI::Prototype and use base

by metaperl (Curate)
on Jan 30, 2005 at 14:52 UTC ( [id://426381]=perlquestion: print w/replies, xml ) Need Help??

metaperl has asked for the wisdom of the Perl Monks concerning the following question:

The docs for CGI::Prototype has this as a SYNOPSIS:
package My::HelloWorld; use base CGI::Prototype; sub template { \ <<'END_OF_TEMPLATE' } [% self.CGI.header; %] Hello world at [% USE Date; Date.format(date.now) | html %]! END_OF_TEMPLATE My::HelloWorld->activate;
However, use base is a mechanism for class-based subclassing. After reading merlyn's article, I knew that this was the proper way to do subclassing with protoypes:
package doesnt_matter; use CGI::Prototype; my $derived = Class::Prototyped->newPackage('My::App', ( 'parent*' => 'CGI::Prototype', template => sub { 'blah blah blah' }; ); $derived->activate;
Since the Class::Protoyped docs do not use base anywhere and since neither your article or docs explain how this class-based inheritance mechanism works in a prototyped context please do one of two things: (1) use a more orthodox means of subclassing (2) explain the ramifications behind such use.

To your credit, a file in the test suite does use @ISA, but I am a bit tired of trying to learn CGI::Prototype by inference on the test suite :)

Replies are listed 'Best First'.
Re: CGI::Prototype and use base
by metaperl (Curate) on Jan 31, 2005 at 10:49 UTC
    And as a meta-note, I'm not sure The Monastery is a good place for you to submit bug reports
    I dont have a bug report as much as I have a usage question.
    nor demonstrate your ignorance in public
    I see, well, I think it is a matter of how digestible and convenient the material is. By that token, each of the 3 O'Reilly books you've written should never have been written. None of the 3 offers a superset of the information contained in the Perl manpages... but you wrote them for a reason. You wrote them to give people with limited time amd attention span and possibly a less technical way of thinking an avenue into learning Perl.

    If someone finished reading learning Perl and posted a question here on something beyond the scope of that book, would you have been so rude with your response? Would you have quoted something from perlvar and attempted to face-job them?

    I'm sorry I have to be the one to take the bullets here. Someone had to ask the questions that everyone wanted answered too but didn't have the time/interest to stare at your source and then create a critical but constructive assessment (which took me about 2 hours to do and redo and rethink and reformulate).

    But you do have a very nice product here. It allows me to think about where to put things and code large parts of a website I'm doing in isolation and then have Perl beautifully string together the parts as necessary. It is quite a work of genius, evolution and experience. The dot-com era needed this and some of the nicer Templating modules to avoid the "perl/CGI" impression of Perl that many people continue to stereotype Perl-based webapp development by.

Re: CGI::Prototype - SYNOPSIS shows arcane and heterodox inheritance
by brian_d_foy (Abbot) on Jan 31, 2005 at 05:41 UTC

    CGI::Prototype is open source. If you don't like the docs and think it should add things, submit a patch. You've obviosuly spent some time with the framework, so take what you've learned and give it back the the community by adding to the docs. At least you have docs: I learned CGI::Prototype with nothing but source. :)

    If you want to learn how things work, you have to understand the Prototype design pattern and Class::Prototype. After that, you shouldn't have to worry about how things happen as long as they do happen.

    No matter what you decide, you could be part of the solution rather than carping about what Randal is giving you for free.

    --
    brian d foy <bdfoy@cpan.org>

      Is he really carping? He's carping about getting a mailinglist, but other than that I see him mostly taking notes as he learns. To me that seems like contribution in its own right, albeit messy and incoherent in nature.

      The tired adage that “it's open source so if you don't like it then do something about it” is a sometimes all too convenient way to deflect complaints. There is no entitlement to good documentation any more than there is to the code itself or any other effort on the author's part, of course, but we need to understand that lack of documentation, no matter how good and clear the code, always severely degrades its quality.

      Makeshifts last the longest.

        I'm not using a tired adage. I see a person who's putting their head in the code, figuring a lot of things out, writing a lot about things, but not doing anything other than carping to change the docs. He has the knowledge and the time to elaborate on the stuff he wants added to the docs, so he has the time to patch the docs. We all know that a lack of documentation is bad, so instead of talking about it, I'd like to see someone offer to fix it. So far I've seen a lot of debate and no patches, and the situation hasn't changed.

        I'm not deflecting complaints: I'm encouraging good citizenship and suggesting the course of action that is better suited to get results. Obviously what he's doing now is not satisfying him.

        --
        brian d foy <bdfoy@cpan.org>
      No matter what you decide, you could be part of the solution rather than carping about what Randal is giving you for free.
      I consider my posts a way for him to get an idea of what people don't understand and how he can beef up the docs... given that his docs are probably the weakest part of his distribution, that is a significant contribution.

      Also, given that he has repeatedly ignored my requests for a mailing list, I see this is as a good place for many people of about my aptitude and patience to get the same question answered once.

      This module is going to create some interesting design questions as development goes deeper. These are things that are beyond the mere technical aspects of prototyped-based programming. A bug report queue is not the place for it.

        If you want a mailing list, just set one up. There is no law that says that Randal has to be the one to do it. You have something you want to talk about with other people, so take the action you need to do that.

        --
        brian d foy <bdfoy@cpan.org>
Re: CGI::Prototype - SYNOPSIS shows arcane and heterodox inheritance
by merlyn (Sage) on Jan 30, 2005 at 15:02 UTC
    From Class::Prototyped:
    The code that implements reflection on classes automatically cr +eates slot names for package methods as well as parent slots for the +entries in @ISA. This means that you can code classes like you normall +y do - by doing the inheritance in @ISA and writing package methods.
    I consider the Class::Prototyped docs as required reading material before reading CGI::Prototype, hence the reference early on in the manpage.

    And as a meta-note, I'm not sure The Monastery is a good place for you to submit bug reports against the software, nor demonstrate your ignorance in public. Please consider more traditional means for either or both of those activities.

    -- Randal L. Schwartz, Perl hacker
    Be sure to read my standard disclaimer if this is a reply.

      Thank you for your speedy response.
      And as a meta-note, I'm not sure The Monastery is a good place for you to submit bug reports against the software, nor demonstrate your ignorance in public.
      1. I keep asking you to form a mailing list and for the past two weeks, nothing has happened. Do your docs state where questions for support should go?
      2. Every question submitted to Seekers of Perl Wisdom is based on the poster having "ignorance" as you put it. Therefore unless you create a forum of discussion of your module, it seems an appropriate place. In addition, you should take my ignorance as a cue for what parts of the Class::Prototyped docs are most relevant to your module and to which you might provide a bridge in your own documentation.
        I read the bug reports at http://rt.perl.org. That's where to submit bug reports.

        And, nearly everything you've "wondered" about, you then answer yourself within 8 hours. Seems like if you just slow down a bit at posting, you'll have the right answer yourself shortly thereafter.

        -- Randal L. Schwartz, Perl hacker
        Be sure to read my standard disclaimer if this is a reply.

        Please consider more traditional means for either or both of those activities.
        Could you be more explicit? State your desired communication channel either in this node or in your docs in a SUPPORT section.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://426381]
Approved by holli
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (4)
As of 2024-03-28 23:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found