Re: [PATCH 5/7] gitweb: auxiliary functions to group data
- From
Jakub Narebski <jnareb@gmail.com>
- Date
- Sep 17, 2010, 16:06 UTC
- Message-ID
- <201009171806.49774.jnareb@gmail.com>
- In-Reply-To
- <AANLkTikk7vUFMr31Azdcpe+PK0-yA2sp2EcnHjdfw0Zn@mail.gmail.com>
Giuseppe Bilotta wrote:
Show 13 quoted lines
> On Fri, Sep 17, 2010 at 3:24 AM, Jakub Narebski <jnareb@gmail.com> wrote: > > > > ... but I think that having separate subroutines for opening and > > closing tags is a bad design / bad API (except in some rare cases). > > It is begging for unbalanced HTML. > > > > It would be better if it was a single subroutine wrapping 'div' around > > contents given either as a string, or via callback (subroutine reference), > > in my opinion. > > I'm not sure that in this case the string or callback approach would > be any cleaner. I'll see if perl supports closures or something like > that.
Perl supports closures (thanks to anonymous subroutines 'sub { ... }' and lexical variables 'my $var'), see perlsub and "Function Templates" in perlref.
I also recommend free ebook "Higher-Order Perl" http://hop.perl.plover.com/
-- Jakub Narebski Poland