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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2010/5/13 Peter Vereshagin <peter@xxxxxxxxxxxxxx>:
> Hey Mr(s) Jakub show some good to me!
> 2010/05/11 15:51:15 +0200 Jakub Narebski <jnareb@xxxxxxxxx> => To Peter Vereshagin :
> JN> On Tue, 11 May 2010, Peter Vereshagin wrote:
> JN> > 2010/05/11 12:58:50 +0200 Jakub Narebski <jnareb@xxxxxxxxx> => 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.

> 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.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]