t; Hi All,
>
> When reading a text file
> https://docs.perl6.org/routine/lines
> seems pretty straight forward.
>
> Question: How do I tell when I when I have
> reached the EOF (End Of File)?
>
> Many thanks,
&
0/9/18 1:02 AM, ToddAndMargo via perl6-users wrote:
> > Hi All,
> >
> > When reading a text file
> > https://docs.perl6.org/routine/lines
> > seems pretty straight forward.
> >
> > Question: How
iterates the Seq, printing all the
lines.
The second call to .lines() returns nothing because you're now at eof,
no more lines.
Note the Seq that .lines returns itself is lazy. It doesn't
(necessarily) have all the lines, just the capability to get them.
As you iterate the Seq, it pulls in all t
text file
> > > https://docs.perl6.org/routine/lines
> > > seems pretty straight forward.
> > >
> > > Question: How do I tell when I when I have
> > > reached the EOF (End Of File)?
> > >
> > > Many t
On Tue, Oct 9, 2018 at 8:31 AM Curt Tilmes wrote:
>
> On Tue, Oct 9, 2018 at 9:27 AM Laurent Rosenfeld via perl6-users
> wrote:
>>
>> This:
>> my $f = $fh.lines;
>> will slurp all the lines into $f (but you can still access the individual
>> items with something like $f[4]).
>
>
> Is that
Yes, you're right, it is a Seq. I was trying to be pedagogical, but
probably wasn't very accurate. It is a Seq, and the "slurping" will be lazy.
Le mar. 9 oct. 2018 à 15:30, Curt Tilmes a écrit :
> On Tue, Oct 9, 2018 at 9:27 AM Laurent Rosenfeld via perl6-users <
> perl6-us...@perl.org>
On Tue, Oct 9, 2018 at 9:27 AM Laurent Rosenfeld via perl6-users <
perl6-us...@perl.org> wrote:
> This:
> my $f = $fh.lines;
> will slurp all the lines into $f (but you can still access the individual
> items with something like $f[4]).
>
Is that true? I supposed that it would hold the Seq as a
ddAndMargo via perl6-users wrote:
> > > Hi All,
> > >
> > > When reading a text file
> > > https://docs.perl6.org/routine/lines
> > > seems pretty straight forward.
> > >
> > > Question: How do I tell when
es.
The second call to .lines() returns nothing because you're now at eof, no
more lines.
Note the Seq that .lines returns itself is lazy. It doesn't (necessarily)
have all the lines, just the capability to get them.
As you iterate the Seq, it pulls in all the lines.
Curt
t; Hi All,
>
> When reading a text file
> https://docs.perl6.org/routine/lines
> seems pretty straight forward.
>
> Question: How do I tell when I when I have
> reached the EOF (End Of File)?
>
> Many thanks,
> -T
Plea
How do I tell when I when I have
reached the EOF (End Of File)?
Many thanks,
-T
On 10/9/18 4:38 AM, Laurent Rosenfeld via perl6-users wrote:
The eof method of the IO::Handle class returns True if you exhausted
the contents of the handle, but you generally don't need to use that,
https://docs.perl6.org/routine/lines
> > seems pretty straight forward.
> >
> > Question: How do I tell when I when I have
> > reached the EOF (End Of File)?
> >
> > Many thanks,
> > -T
>
> Please expand the question to include `read` and `readchars`.
>
--
Fernando Santagata
Le mar. 9 oct. 2018 à 10:03, ToddAndMargo via perl6-users
mailto:perl6-us...@perl.org>> a écrit :
Hi All,
When reading a text file
https://docs.perl6.org/routine/lines
seems pretty straight forward.
Question: How do I tell when I when I have
reached the EO
The eof method of the IO::Handle class returns True if you exhausted the
contents of the handle, but you generally don't need to use that, since
something like:
for 'input.txt'.IO.lines -> $line {
# Do something with $line
}
will gracefully handle ends of files for you without you hav
On 10/9/18 1:02 AM, ToddAndMargo via perl6-users wrote:
Hi All,
When reading a text file
https://docs.perl6.org/routine/lines
seems pretty straight forward.
Question: How do I tell when I when I have
reached the EOF (End Of File)?
Many thanks,
-T
Please expand the question to include
Hi All,
When reading a text file
https://docs.perl6.org/routine/lines
seems pretty straight forward.
Question: How do I tell when I when I have
reached the EOF (End Of File)?
Many thanks,
-T
On Sun, 28 May 2017 13:09:18 -0700, barto...@gmx.de wrote:
> Currently rakudo on JVM does not respect eof when reading from stdin.
>
> bartolin_ r: .say for lines()
> camelia rakudo-moar 094e77: OUTPUT: «»Wann treffen wir drei
> wieder zusamm?« »Um die siebente Stund‘,
On Sun, 13 Nov 2016 08:07:34 -0800, vivids...@gmail.com wrote:
> Hello
>
> It is expected to be able to pass multiple eof-s (by pressing Ctrl+D).
>
> working p5 script: multiple-eof.pl
> and two variants of p6 scripts, which falls to endless loop after
> first "eof&quo
On Sun, 13 Nov 2016 08:07:34 -0800, vivids...@gmail.com wrote:
> Hello
>
> It is expected to be able to pass multiple eof-s (by pressing Ctrl+D).
>
> working p5 script: multiple-eof.pl
> and two variants of p6 scripts, which falls to endless loop after
> first "eof&quo
# New Ticket Created by Christian Bartolomaeus
# Please include the string: [perl #131393]
# in the subject line of all future correspondence about this issue.
# https://rt.perl.org/Ticket/Display.html?id=131393 >
Currently rakudo on JVM does not respect eof when reading from st
# New Ticket Created by vividsnow
# Please include the string: [perl #130086]
# in the subject line of all future correspondence about this issue.
# https://rt.perl.org/Ticket/Display.html?id=130086 >
Hello
It is expected to be able to pass multiple eof-s (by pressing Ctrl+D).
working
# New Ticket Created by Vittore SCOLARI
# Please include the string: [perl #127423]
# in the subject line of all future correspondence about this issue.
# https://rt.perl.org/Ticket/Display.html?id=127423 >
Typing the following on the command line:
perl6 -e 'say @*ARGS[0].IO.open(:r).lines'
: OUTPUT«42»
TimToady masak: it's just an EOF anomaly
moritz m: say abs -42:;
camelia rakudo-moar f1fa64: OUTPUT«42»
moritz m: say abs -42:
camelia rakudo-moar f1fa64: OUTPUT«===SORRY!=== Error while
compiling /tmp/V2UzSPiN8kConfused [...]
* masak submits rakudobug
On Fri Jun 26 01:42:55 2009, moritz wrote:
On Thu Jun 25 08:54:51 2009, pmichaud wrote:
This was caused by a bug in Parrot; the problem in Parrot seems to have
been resolved and now EOF appears to work again.
Right, but exit; still doesn't.
Closing ticket, thanks!
... and re
This was caused by a bug in Parrot; the problem in Parrot seems to have
been resolved and now EOF appears to work again.
Closing ticket, thanks!
Pm
# New Ticket Created by Moritz Lenz
# Please include the string: [perl #66050]
# in the subject line of all future correspondence about this issue.
# URL: http://rt.perl.org/rt3/Ticket/Display.html?id=66050
On the REPL, neither `exit;' nor sending an EOF (view Ctrl+D on Unix)
terminate
. Any read ahead can be a bit expensive. I
experimented
with a quick patch to use 'peek' in the test for EOF in Parrot,
just to
see what would happen... it broke a large quantity of code (probably
because all the code is expecting the old behavior of the EOF test, or
possibly a bug in 'peek
# New Ticket Created by Jonathan Worthington
# Please include the string: [perl #61224]
# in the subject line of all future correspondence about this issue.
# URL: http://rt.perl.org/rt3/Ticket/Display.html?id=61224
Hi,
It seems that the .eof() method on file handles can sometimes return
# New Ticket Created by Paul Cochrane
# Please include the string: [perl #46835]
# in the subject line of all future correspondence about this issue.
# URL: http://rt.perl.org/rt3/Ticket/Display.html?id=46835
In t/pmc/parrotio.t there is the todo item:
# TODO test reading long chunks, eof
# New Ticket Created by Paul Cochrane
# Please include the string: [perl #40776]
# in the subject line of all future correspondence about this issue.
# URL: http://rt.perl.org/rt3/Ticket/Display.html?id=40776
Create test files and read from them, testing the eof condition in
languages/tcl/t
Leopold Toetsch [EMAIL PROTECTED] wrote:
Matt Diephouse [EMAIL PROTECTED] wrote:
That still results in in file (unknown) near line -1 being printed
as part of the error message, so I'm leaving this ticket open. (It
annoys me.)
*g*
I've changed now the policy for including source
Matt Diephouse [EMAIL PROTECTED] wrote:
That still results in in file (unknown) near line -1 being printed
as part of the error message, so I'm leaving this ticket open. (It
annoys me.)
*g*
I've changed now the policy for including source line information.
Unless -O is given file and line
Leopold Toetsch [EMAIL PROTECTED] wrote:
Matt Diephouse [EMAIL PROTECTED] wrote:
It also changes the function used to raise the exception from
real_exception to internal_exception
We've to change a lot of internal_exceptions to real ones eventually and
print better diagnostics, so no.
Matt Diephouse [EMAIL PROTECTED] wrote:
The attached patch changes the error to:
Cannot read line from empty filehandle
Done.
It also changes the function used to raise the exception from
real_exception to internal_exception
We've to change a lot of internal_exceptions to real ones
=33171
Reading past the EOF in PIR results in the following error:
File not found
in file '(unknown file)' near line -1
That's less than helpful. Or at least less helpful than it could be. A
better error would be really nice.
The attached patch changes the error to:
Cannot
# New Ticket Created by Matt Diephouse
# Please include the string: [perl #33171]
# in the subject line of all future correspondence about this issue.
# URL: http://rt.perl.org:80/rt3/Ticket/Display.html?id=33171
Reading past the EOF in PIR results in the following error:
File not found
I noticed a hole in the io.ops where the PIO stuff wasn't covered. This
patch creates an eof opcode which checks for end of file.
Brian Wheeler
[EMAIL PROTECTED]
cvs diff: Diffing .
cvs diff: Diffing ops
Index: ops/io.ops
===
RCS
Brian Wheeler [EMAIL PROTECTED] wrote:
I noticed a hole in the io.ops where the PIO stuff wasn't covered. This
patch creates an eof opcode which checks for end of file.
Please just use the eof method of the PIO object:
$I0 = $P0.eof()
leo
38 matches
Mail list logo