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

Re: perlopentut modernization

Thread Previous | Thread Next
From:
Alexander Hartmaier
Date:
February 14, 2013 08:44
Subject:
Re: perlopentut modernization
Message ID:
CAB49QrbwjTwOQy=9=0vEs2SVC65MkNt9pJ0ajsxsFLqoiHSFEg@mail.gmail.com
Thanks for reviewing Ricardo!

On Thu, Feb 14, 2013 at 3:51 AM, Ricardo Signes
<perl.p5p@rjbs.manxome.org>wrote:

> * 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
>
I was thinking about even use-ing English and its $OS_ERROR  (or $ERRNO),
what do you think about that?


>
> 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
>
As demerhq already pointed out that's not something I've written but just
left in from the current doc. I not even knew that before I've started
working on the doc.
As I don't want to advocate the two-arg open form I'd rather remove this
from the tutorial than including in a 2-arg open section where people might
start using it again because of this 'feature'.

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