develooper Front page | perl.perl5.porters | Postings from February 2013

Re: perlopentut modernization

Thread Previous | Thread Next
From:
Ricardo Signes
Date:
February 14, 2013 02:52
Subject:
Re: perlopentut modernization
Message ID:
20130214025153.GA8468@cancer.codesimply.com
* Alexander Hartmaier <alex.hartmaier@gmail.com> [2013-01-19T06:54:56]
> ...

Sorry for the delay.  I'm finally reviewing!

This is a sort of random collection of reactions.  Sorry for any confusion to
my thoughts.

special variable C<$!>  -- should link to perlvar, since $! is a bit weird

You write:

  "The other important thing to notice is that, just as in the shell, any
  whitespace before or after the filename is ignored."

But:

  ~$ perl -E "open( my \$fh, '>', 'foo '); print {\$fh} 'hi'; close \$fh; say
  -e 'foo ' ? 1 : 0; say -e 'foo' ? 1 : 0"
  1
  0

...which indicates that you are wrong.  I believe this is only true of two-arg
open.  I am concerned by this inaccuracy, as it may foretell more to come on
subtler points.

For example, again:

  ~$ head -1 dupes
  use 5.16.0;
  ~$ perl -E 'my $x = "dupes\n"; open my $fh, "<", $x or die "cannot open $x:
  $!"'
  cannot open dupes
  : No such file or directory at -e line 1.

Or:

  ~$ cat files.txt
  dupes
  ~$ perl -E 'while (<>) { open my $fh, "<", $_ or die "cannot open $_: $!";
  print <$fh>; }' files.txt
  cannot open dupes
  : No such file or directory at -e line 1, <> line 1.

I think at this point I'm going to stop.  The whole document needs to be
checked for accuracy of these kind of claims before it is possible to even
consider merging.

Committers: do not merge this branch yet.

-- 
rjbs

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About