[cgiapp] Re: ($self vs $c) was: Re: New Plugin: RunmodeDeclare

Mark Stosberg mark at summersault.com
Mon Sep 29 11:33:23 EDT 2008


On Mon, 29 Sep 2008 09:14:43 -0400
Michael Peters <mpeters at plusthree.com> wrote:

> Richard Jones wrote:
> 
> > Actually prefer $c these days as a) it's shorter and therefore quicker 
> > and less easy to mis-spell (I seem to type slef more often than self), 
> > but more importantly, having done a lot of work with Catalyst recently, 
> > that's the Cat standard also, so it's familiar to me.

Thanks for the feedback, everyone. The majority of opinions have been
for "$self", so I feel good about proceeding with the dev release for
CGI::App which returns  to that. 

> This actually came up in our discussions and we thought it would cause more
> confusion since in Catalyst the $c is not $self. It's a different object
> entirely. So calling it $c in C::A land might confuse the catalyst folks
> since it's really $self just shorter. Also, for folks playing with Titanium
> (which btw, does not have a friendly abbreviation :) do you plan on still
> using $c? Or will you go with $t?

Like Richard, I also found using "$c" being able to switch back and
forth between looking at Catalyst code and CGI::App code. They use "$c"
a lot like we use "$self".

I haven't decided whether or not to keep recommending "$c" in Titanium.
It's definitely a project that is more about reflecting personal taste,
while CGI::App is more owned and shared by the community. My personal 
taste still leans towards "$c" for my own work. 

I would not use "$t", which has traditionally being used to represent
the template object returned from load_tmpl(). ( I think even CGI::App
documents it that way. )

Does anyone remember the source formatting in CGI::Application::Plus? 
http://search.cpan.org/src/DOMIZIO/CGI-Application-Plus-1.21/lib/CGI/Application/Plus.pm

( For those new here, this is a fork that is *not* generally considered
a "plus" ).

It left-aligns commas and semi-colons.  I actually agree with the
sentiment that this style makes it easier to catch bugs with missing
semi-colons.  

I sometimes use the technique in lists of SQL fields, where it is a bug
to include an extra comma.

But I don't dare use the technique in Perl code, because it strays so
far from the normal expected standards for code formatting.

While you may disagree about the code formatting example, it's an
illustration for the broader point. Sometimes while it makes sense to
follow a standard for the sake of having a standard (Hello, XML), there
are times when the most widely accepted standards turn out not to be
best choices if given the chance to start over.

    Mark




More information about the cgiapp mailing list