From: Peter Vereshagin <peter@vereshagin.org>
To: ??var Arnfj??r?? Bjarmason <avarab@gmail.com>
Cc: Peter Vereshagin <peter@vereshagin.org>,
Jakub Narebski <jnareb@gmail.com>, Petr Baudis <pasky@suse.cz>,
Eric Wong <normalperson@yhbt.net>,
git@vger.kernel.org, Sam Vilain <sam.vilain@catalyst.net.nz>,
Juan Jose Comellas <juanjo@comellas.org>,
John Goerzen <jgoerzen@complete.org>
Subject: Re: [PATCH 0/2] gitweb: Add support for running gitweb as FastCGI script
Date: Fri, 14 May 2010 19:58:06 +0400 [thread overview]
Message-ID: <20100514155806.GC17443@screwed.box> (raw)
In-Reply-To: <AANLkTilnaHQ4Q8n3GOhYPcYAFi_tT8uSE_uTZhU_QYhK@mail.gmail.com>
God love is hard to find. You got lucky ??var!
2010/05/13 17:13:12 +0000 ??var Arnfj??r?? Bjarmason <avarab@gmail.com> => To Peter Vereshagin :
vArB> 2010/5/13 Peter Vereshagin <peter@vereshagin.org>:
vArB> > Hey Mr(s) Jakub show some good to me!
vArB> > 2010/05/11 15:51:15 +0200 Jakub Narebski <jnareb@gmail.com> => To Peter Vereshagin :
vArB> > JN> On Tue, 11 May 2010, Peter Vereshagin wrote:
vArB> > JN> > 2010/05/11 12:58:50 +0200 Jakub Narebski <jnareb@gmail.com> => To Peter Vereshagin :
vArB> > JN>
vArB> > JN> > > > > I have changed this 'exit' to non-local goto to toplevel. It could be
vArB> > JN> > > > > done instead by redefining 'exit' subroutine, like shown below, but I
vArB> > JN> > > > > feel that would be hacky if you can change gitweb code (it is not
vArB> > JN> > > > > black box you should not touch).
vArB> > JN> > > >
vArB> > JN> > > > Right, one shouldn't ever redefine perl built-in functions. I did only because
vArB> > JN> > > > of no other way to 'get things working'
vArB> > JN> > >
vArB> > JN> > > Why not? For example CGI::Carp redefines 'die' to log errors.
vArB> > JN> >
vArB> > JN> > Ouch, sorry, I meant 'last' or something like that.
vArB> > JN>
vArB> > JN> "last" / "last LABEL" is a command, not a function, therefore you cannot
vArB> > JN> redefine it.
vArB> >
vArB> > it's a flow control statement thus it is a built-in thing same way as any other
vArB> > functions are explained in a 'perldoc -f'
vArB> > Therefore it is treated by monkeys crowd as function. It's obvious for me to
vArB> > stay out here ( here != maillist ) yet in such an environment.
vArB>
vArB> These things are called "operators" in Perl, some of them (like exit)
vArB> you can redefine. Some (like last) you can't. At least not without
vArB> some deep magic.
problem is not the naming, but that those are built-in and supposed to be used
'as is'. Operators or functions are whatever, but for perldoc they are the '-f'
so think not a big problem I named them functions.
vArB> > Anyway, I compare last() here with exit() and die() which look to user just
vArB> > like the same kind of: the flow control statements. I guess any perl user who
vArB> > makes things like gitweb ( at least as a CGI-only app ) shouldn't care about
vArB> > such an internal difference of flow control statements those are
vArB> > hidden/incapsulated inside the implementation of those statements?
vArB> > Needless to mention that the 'last LABEL' ( goto, gosub, ... named them ) is a
vArB> > bad and a very deprecated style which is every schoolboy is aware about
vArB> > nowadays to keep from using in the application, not system, programming in imho
vArB> > every language.
vArB>
vArB> `last LABEL' is not bad or deprecated. It's what you use to get out of
vArB> nested for-loops in Perl:
vArB>
vArB> OUTER: for my $i (1 .. 10) {
vArB> for my $j (1 .. 10) {
vArB> last OUTER if $i == 5 and $j == 5;
vArB> }
vArB> }
vArB>
vArB> goto is also recommended in some cases in Perl. That's because it
vArB> doesn't do the same thing as in C:
vArB>
vArB> # Don't create a stack frame
vArB> sub foo { goto &bar }
vArB>
vArB> Anyway, arguing over which control flow operator is evil in an
vArB> imperitive language is just splitting hairs. Certain uses of them are
vArB> a bad idea, not the operators themselves.
correct, just use-cases are a thing to change like cgi to fastcgi environment,
this is where exit() is intended to be redefined for performance reasons. Thus
original uses are not as certain as they were supposed to be at the moment of
applications' coding: there were no idea why the END{}'s exit() is any better
than the explicit in-code one. It's just can cause the lack of the performance
and should be avoided in persistent perl processes to serve such a CGI-like
applications.
73! Peter pgp: A0E26627 (4A42 6841 2871 5EA7 52AB 12F8 0CE1 4AAC A0E2 6627)
--
http://vereshagin.org
next prev parent reply other threads:[~2010-05-14 15:58 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-07 12:54 [PATCH 0/2] gitweb: Add support for running gitweb as FastCGI script Jakub Narebski
2010-05-07 12:54 ` [PATCH/RFC 1/2] gitweb: Put all per-connection code in run() subroutine Jakub Narebski
2010-05-07 12:54 ` [RFC/PATCH 2/2] gitweb: Add support for FastCGI, using CGI::Fast Jakub Narebski
2010-05-08 7:59 ` [RFC/PATCHv2 " Jakub Narebski
2010-05-08 22:41 ` [PATCH 0/2] gitweb: Add support for running gitweb as FastCGI script Jakub Narebski
2010-05-09 9:31 ` Eric Wong
2010-05-09 11:48 ` Ævar Arnfjörð Bjarmason
2010-05-09 12:39 ` Jakub Narebski
2010-05-09 16:47 ` Peter Vereshagin
2010-05-09 18:18 ` Jakub Narebski
2010-05-10 7:13 ` Peter Vereshagin
2010-05-10 15:29 ` Jakub Narebski
2010-05-11 6:24 ` Peter Vereshagin
2010-05-11 8:35 ` Petr Baudis
2010-05-11 10:58 ` Jakub Narebski
2010-05-11 12:09 ` Peter Vereshagin
2010-05-11 13:51 ` Jakub Narebski
2010-05-13 13:10 ` Peter Vereshagin
2010-05-13 17:13 ` Ævar Arnfjörð Bjarmason
2010-05-14 15:58 ` Peter Vereshagin [this message]
2010-05-14 10:53 ` Jakub Narebski
2010-05-14 15:36 ` Peter Vereshagin
2010-05-14 17:58 ` Jakub Narebski
2010-05-14 18:43 ` Jakub Narebski
2010-05-15 10:06 ` Peter Vereshagin
2010-05-15 13:58 ` Jakub Narebski
2010-05-16 10:15 ` Peter Vereshagin
2010-05-18 1:06 ` Jakub Narebski
2010-05-16 10:26 ` Petr Baudis
2010-05-15 11:51 ` Petr Baudis
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100514155806.GC17443@screwed.box \
--to=peter@vereshagin.org \
--cc=avarab@gmail.com \
--cc=git@vger.kernel.org \
--cc=jgoerzen@complete.org \
--cc=jnareb@gmail.com \
--cc=juanjo@comellas.org \
--cc=normalperson@yhbt.net \
--cc=pasky@suse.cz \
--cc=sam.vilain@catalyst.net.nz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.