develooper Front page | perl.perl6.language | Postings from May 2001

Re: Apoc2 - <STDIN> concerns

From:
Stephen P. Potter
Date:
May 15, 2001 13:18
Subject:
Re: Apoc2 - <STDIN> concerns
Message ID:
20010515202214.232F4729E1@belgarath.spotter.yi.org
Lightning flashed, thunder crashed and Larry Wall <larry@wall.org> whispered:
| Simon Cozens writes:
| : On Fri, May 04, 2001 at 04:42:07PM -0700, Nathan Wiger wrote:
| : > :      while ($STDIN) { ... }
| : > I'm wondering what this will do?
| : >    $thingy = $STDIN;
| : > This seems to have two possibilities:
| : >    1. Make a copy of $STDIN
| : 
| : This one. I see a filehandle in *boolean* context meaning "read to $_",
| 
| It would be $FOO.next, but yes, that's the basic idea.  It's possible

Urr?  How often do you dup filehandles as opposed to reading filehandles?
I think we would be much better off with

	$thingy = $STDIN;

reading a line from $STDIN rather than duping it.  Otherwise, we'll be
constantly having to type five more characters (.next) for a very common
practice.

I'm also concerned about the confusion between C<$MARK.next> and C<next
$MARK> (of course, we haven't seen whether C<next> is going to change).
At the very least,  wouldn't C<$STDIN.read> be better and more orthagonal
with C<read(STDIN)>.

-spp



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