git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 0/2] gitweb: Add support for running gitweb as FastCGI script

From
Peter Vereshagin <peter@vereshagin.org>
Date
May 14, 2010, 15:58 UTC
Message-ID
<20100514155806.GC17443@screwed.box>
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
Previous: Ævar Arnfjörð BjarmasonNext: Jakub Narebski
Message 20 of 30 in “gitweb: Add support for running gitweb as FastCGI script”
  1. 0/2 gitweb: Add support for running gitweb as FastCGI scriptJakub Narebski, May 7, 2010
  2. 1/2 gitweb: Put all per-connection code in run() subroutineJakub Narebski, May 7, 2010
  3. 2/2 gitweb: Add support for FastCGI, using CGI::FastJakub Narebski, May 7, 2010
  4. 2/2 gitweb: Add support for FastCGI, using CGI::FastJakub Narebski, May 8, 2010
  5. Jakub NarebskiMay 8, 2010
  6. Eric WongMay 9, 2010
  7. Ævar Arnfjörð BjarmasonMay 9, 2010
  8. Jakub NarebskiMay 9, 2010
  9. Peter VereshaginMay 9, 2010
  10. Jakub NarebskiMay 9, 2010
  11. Peter VereshaginMay 10, 2010
  12. Jakub NarebskiMay 10, 2010
  13. Peter VereshaginMay 11, 2010
  14. Petr BaudisMay 11, 2010
  15. Jakub NarebskiMay 11, 2010
  16. Peter VereshaginMay 11, 2010
  17. Jakub NarebskiMay 11, 2010
  18. Peter VereshaginMay 13, 2010
  19. Ævar Arnfjörð BjarmasonMay 13, 2010
  20. Peter VereshaginMay 14, 2010
  21. Jakub NarebskiMay 14, 2010
  22. Peter VereshaginMay 14, 2010
  23. Jakub NarebskiMay 14, 2010
  24. Jakub NarebskiMay 14, 2010
  25. Peter VereshaginMay 15, 2010
  26. Jakub NarebskiMay 15, 2010
  27. Peter VereshaginMay 16, 2010
  28. Jakub NarebskiMay 18, 2010
  29. Petr BaudisMay 16, 2010
  30. Petr BaudisMay 15, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.