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
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
May 13, 2010, 17:13 UTC
Message-ID
<AANLkTilnaHQ4Q8n3GOhYPcYAFi_tT8uSE_uTZhU_QYhK@mail.gmail.com>
In-Reply-To
<20100513131016.GA5250@screwed.box>
2010/5/13 Peter Vereshagin <peter@vereshagin.org>:
Show 24 quoted lines
> Hey Mr(s) Jakub show some good to me!
> 2010/05/11 15:51:15 +0200 Jakub Narebski <jnareb@gmail.com> => To Peter Vereshagin :
> JN> On Tue, 11 May 2010, Peter Vereshagin wrote:
> JN> > 2010/05/11 12:58:50 +0200 Jakub Narebski <jnareb@gmail.com> => To Peter Vereshagin :
> JN>
> JN> > > > > I have changed this 'exit' to non-local goto to toplevel.  It could be
> JN> > > > > done instead by redefining 'exit' subroutine, like shown below, but I
> JN> > > > > feel that would be hacky if you can change gitweb code (it is not
> JN> > > > > black box you should not touch).
> JN> > > >
> JN> > > > Right, one shouldn't ever redefine perl built-in functions. I did only because
> JN> > > > of no other way to 'get things working'
> JN> > >
> JN> > > Why not?  For example CGI::Carp redefines 'die' to log errors.
> JN> >
> JN> > Ouch, sorry, I meant 'last' or something like that.
> JN>
> JN> "last" / "last LABEL" is a command, not a function, therefore you cannot
> JN> redefine it.
>
> it's a flow control statement thus it is a built-in thing same way as any other
> functions are explained in a 'perldoc -f'
> Therefore it is treated by monkeys crowd as function. It's obvious for me to
> stay out here ( here != maillist ) yet in such an environment.

These things are called "operators" in Perl, some of them (like exit) you can redefine. Some (like last) you can't. At least not without some deep magic.

Show 9 quoted lines
> Anyway, I compare last() here  with exit() and die() which look to user just
> like the same kind of: the flow control statements. I guess any perl user who
> makes things like gitweb ( at least as a CGI-only app ) shouldn't care about
> such an internal difference of flow control statements those are
> hidden/incapsulated inside the implementation of those statements?
> Needless to mention that the 'last LABEL' ( goto, gosub, ... named them )  is a
> bad and a very deprecated style which is every schoolboy is aware about
> nowadays to keep from using in the application, not system, programming in imho
> every language.

`last LABEL' is not bad or deprecated. It's what you use to get out of nested for-loops in Perl:

    OUTER: for my $i (1 .. 10) {
        for my $j (1 .. 10) {
            last OUTER if $i == 5 and $j == 5;
        }
    }

goto is also recommended in some cases in Perl. That's because it doesn't do the same thing as in C:

    # Don't create a stack frame
    sub foo { goto &bar }

Anyway, arguing over which control flow operator is evil in an imperitive language is just splitting hairs. Certain uses of them are a bad idea, not the operators themselves.

Previous: Peter VereshaginNext: Peter Vereshagin
Message 19 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.