CatHandle is the mechanism behind $*ARGFILES.

If you want to read several files as it they were one, you can use
IO::CatHandle.

    my $combined-file = IO::CatHandle.new( 'example_000.txt', *.succ ...
'example_010.txt' );

Basically it works similar to the `cat` command-line utility. (Hence its
name)

The reason it is read-only, is because it is difficult to figure out which
file you actually want to write to.

Imagine you read the first file, and then wrote something.
Should it write to the end of the first file, or the beginning of the
second file?

On Tue, Oct 22, 2019 at 2:08 PM Marcel Timmerman <mt1...@gmail.com> wrote:

> On 10/22/19 3:03 PM, Parrot Raiser wrote:
> > CatHandle? Is that an alias for "tail"?  :-)*
> hehe, that's a nice word change... Well, I've seen it here at
> https://docs.perl6.org/routine/readchars
>
> But there's also IO::Handle .... What I've understood is that the
> CatHandle does the same as a readonly IO::Handle can. Writing will throw
> exceptions. So in the end it looks like the Unix tail program.
>
> Marcel
> >
> > On 10/22/19, Marcel Timmerman <mt1...@gmail.com> wrote:
> >> On 10/22/19 1:05 PM, Marcel Timmerman wrote:
> >>> On 10/20/19 11:38 PM, Joseph Brenner wrote:
> >>>> I was just thinking about the case of processing a large file in
> >>>> chunks of an arbitrary size (where "lines" or "words" don't really
> >>>> work).   I can think of a few approaches that would seem kind-of
> >>>> rakuish, but don't seem to be built-in anywhere... something like a
> >>>> variant of "slurp" with an argument to specify how much you want to
> >>>> slurp at a time, that'll move on to the next chunk the next time it's
> >>>> invoked...
> >>>>
> >>>> Is there anything like that kicking around that I've missed?
> >>> as a side note, there is also a .IO.CHandle.readchars($size), with
> >>> $size a default of 64 kb.
> >>>
> >>> Regards,
> >>> Marcel
> >> I meant  .IO.CatHandle.readchars($size)
> >> sorry
> >> M
> >>
>

Reply via email to