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

Re: [PATCH 6/6] Remove bareword filehandles in git-send-email.perl

From
H.Merijn Brand <h.m.brand@xs4all.nl>
Date
May 4, 2009, 07:41 UTC
Message-ID
<20090504094108.0bf52762@pc09.procura.nl>
In-Reply-To
<200905040853.45186.fge@one2team.com>

On Mon, 4 May 2009 08:53:44 +0200, Francis Galiegue <fge@one2team.com> wrote:

Show 17 quoted lines
> Le lundi 04 mai 2009, vous avez écrit :
> [...]
> > > 
> > > And why not go the full way and using IO::File?
> > 
> > Because that would be travelling back in time.
> > The most efficient and preferred way is three-arg lexical:
> > 
> >     open my $fh, "<", $filename or die "$filename: $!";
> >     while (<$fh>) {
> >         # ...
> >         }
> >     close $fh or die "$filename: $!";
> > 
> 
> I don't see how using IO::File is going back in time at all. It's
> a standard perl module, even in 5.10.

It was written to be able to have lexical handles and pass them around. With the above implementation you don't need to read a 600+ line module to have every file action go through methods that are not needed at all, and you also do not have to read the documentation for the deviating syntax. I'd rather stick to simple, easy and standard.

Show 6 quoted lines
> > > my $fh = new IO::File;
> > > $fh->open("/the/file", O_RDONLY|...)
> > 
> > Why use a module for something that is neatly buit in?
> 
> Because it reads better? YMMV, of course.

Because it is more efficient? And yes, it reads better, because it is used in a zillion places already.

> I prefer using IO::File because perl has too many keywords for its
> own good :p
In the syntax I wrote down are now new keywords at all.
-- 
H.Merijn Brand  http://tux.nl      Perl Monger  http://amsterdam.pm.org/
using & porting perl 5.6.2, 5.8.x, 5.10.x, 5.11.x on HP-UX 10.20, 11.00,
11.11, 11.23, and 11.31, OpenSuSE 10.3, 11.0, and 11.1, AIX 5.2 and 5.3.
http://mirrors.develooper.com/hpux/           http://www.test-smoke.org/
http://qa.perl.org      http://www.goldmark.org/jeff/stupid-disclaimers/
Previous: Francis GaliegueNext: Nicolas Sebrecht
Message 12 of 24 in “cleanups for git-send-email”
  1. 0/6 cleanups for git-send-emailBill Pemberton, Apr 29, 2009
  2. 1/6 Remove return undef from validate_patchBill Pemberton, Apr 29, 2009
  3. 2/6 Remove function prototypes from git-send-email.perlBill Pemberton, Apr 29, 2009
  4. 3/6 Remove return undef from ask()Bill Pemberton, Apr 29, 2009
  5. 4/6 Add explict return to end of subroutinesBill Pemberton, Apr 29, 2009
  6. 5/6 Remove mix of high and low-precedence booleansBill Pemberton, Apr 29, 2009
  7. 6/6 Remove bareword filehandles in git-send-email.perlBill Pemberton, Apr 29, 2009
  8. Jeff KingMay 3, 2009
  9. Francis GaliegueMay 3, 2009
  10. H.Merijn BrandMay 4, 2009
  11. Francis GaliegueMay 4, 2009
  12. H.Merijn BrandMay 4, 2009
  13. 5/6 Re: Remove mix of high and low-precedence booleansNicolas Sebrecht, Apr 29, 2009
  14. Bill PembertonApr 29, 2009
  15. Jeff KingMay 3, 2009
  16. Jeff KingMay 3, 2009
  17. Jay SoffianMay 4, 2009
  18. Jeff KingMay 3, 2009
  19. Jeff KingMay 3, 2009
  20. Junio C HamanoApr 29, 2009
  21. Bill PembertonApr 29, 2009
  22. Junio C HamanoApr 29, 2009
  23. 0/6 Re: cleanups for git-send-emailNicolas Sebrecht, Apr 29, 2009
  24. Andreas EricssonApr 30, 2009

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.