Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: Re: CGI::Application vs CGI::Builder

by BUU (Prior)
on May 02, 2004 at 07:09 UTC ( [id://349775]=note: print w/replies, xml ) Need Help??


in reply to Re: CGI::Application vs CGI::Builder
in thread CGI::Application vs CGI::Builder

I'll fourth it and agree that it is bloody evil. For those too lazy to check, heres a quick sample from the top:
package CGI::Builder ; $VERSION = 1.2 ; ; use strict ; use 5.006_001 ; use Carp ; $Carp::Internal{+__PACKAGE__}++ ; $Carp::Internal{'CGI::Builder::_'}++ ; use CGI::Builder::Const qw| :all | ; use IO::Util ; sub capture { my ($s, $h, @args) = @_ ; IO::Util::capture{ $s->$h(@args) } }

Replies are listed 'Best First'.
Re: Re: Re: CGI::Application vs CGI::Builder
by knoebi (Friar) on May 03, 2004 at 07:32 UTC
    I'am using C:B under mod_perl (called Apache-CGI-Builder) for my actual projects and I really like it. It's pretty new thats correct, but the author has first rewritten C:A before he started with C:B, so it seems that he has some experience. C:B has some great features: overrunning concept (the same handler, i.e. a init handler get executed in every class) and some more which are pretty handy, just read the well organized and easy to read documentation! As mentioned above i run all my code under mod_perl and the integration is smooth (including some optimzed code for mod_perl (package variables)). The same author has also written a great template engine, TemplateMagic, it integrates very well with A:C:B, if you have some free time give it a look. it's true that the perl-code doesn't look like the code you see in other modules, but it's very constant and if you have looked at few .pm's i don't think you have any problems reading it. if you get used to TemplateMagic, or read just the documentation, you see that the author is a real perl guy. TemplateMagic is quite simple but offers the greatest flexibilty i've ever seen in a templateengine!
Re: Re: Re: CGI::Application vs CGI::Builder
by Anonymous Monk on May 03, 2004 at 09:32 UTC
    The "Evil" code style is a sort of "mental discipline" which tries to make me remember the semicolons, commas, brackets and parens. :-)

    It is also an attempt to improve the vertical alignment of similar elements, thus trying to *draw* vertical ideal lines enforcing the code structure not just with identation spaces, by also with meaningful characters (similar to the $ % @ & perl characters in front of identifiers).

    Please, look at this simplification of code:

    "Evil" style ; _________ { ____ ( ___ , __ , ___ ) ; _____ ; ___ } More conventional style _________ { ____ ( ___, __, ___ ); _____; ___; }

    Looking at the "Evil" style you will have brackets and semicolons of the same block, always *drawing* a vertical line; same thing for the parens and commas in a list. This make it harder to leave some element out, while the conventional style (being far less vertical aligned), leaves me too freedom to forget something.

    The only drawback is that the "Evil" style it is too unconventional to be used in the examples of my PODs :-(

    Domizio Demichelis

      Howdy!

      There is a "middle" ground...

      _________ { ____ ( ___, __, ___, ); _____; ___; }

      One can (righteously) align paired parens/braces in the vertical axis without using the radical approach of leading off with punctuation.

      yours,
      Michael
      I think the real problem is beginning with semicolons. Sure, you *can*, but it gives the (false) impression that a semicolon is a statement beginner when it's really a statement terminator. I'm sure it's just a minor stylistic quibble anyways, but I prefer my syntax elements to visually look like what they really do, which in this case is ending statements.
        Beginning with semi-colons is also evil because the semi-colon is used to denote the beginning of a comment in some environments. Certainly if I were to see something like:
        ; use strict ; use warnings ; use other_stuff
        I would think "why is he commenting all those out?"

        I think the real problem is beginning with semicolons. Sure, you *can*, but it gives the (false) impression that a semicolon is a statement beginner when it's really a statement terminator.

        Well, since this is a well formed block made of 3 'statements':

        { A ; B ; C }

        I would say that perl uses semicolon to divide/split statements, more as a 'statement separator' than 'statement end' (i.e. neither to end nor to start statements).

        I agree that putting the semicolon at the end is the more popular convention, (and for this reason my style is unconventional), but these are exactly the same block, just splitted after or before the 'statement separator':

        { A ; B ; C } { A ; B ; C }

        the advantage of the latter is the vertical alignment, its disadvantage is that it is unconventional.

        Domizio Demichelis

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (1)
As of 2024-04-25 02:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found