Rules / Types, classes & roles / domain-specific

IO::ArgFiles Reference

Iterate over contents of files specified on command line

What it is #

class IO::ArgFiles is IO::CatHandle { }

Position in the hierarchy #

Inherits fromIO::CatHandle
Does

Examples, run three ways #

Every example below comes from the official documentation, together with the output that documentation asserts. Each was then executed by Rakudo and by Raku++ when this page was built. Where the three agree, one result is shown; where they do not, all three are — because which of them is wrong is exactly the information worth having.

11 no-output

my $argfiles = IO::ArgFiles.new(@*ARGS);
.say for $argfiles.lines;

Not executed: the documentation states no expected output for this example.

my $argfiles = IO::CatHandle.new(@*ARGS);
.say for $argfiles.lines;

Not executed: the documentation states no expected output for this example.

.say for $*ARGFILES.lines;

Not executed: the documentation states no expected output for this example.

# or
while ! $*ARGFILES.eof {
    say $*ARGFILES.get;
}

Not executed: the documentation states no expected output for this example.

# or
say $*ARGFILES.slurp;

Not executed: the documentation states no expected output for this example.

Shall I compare thee to a summer's day?

Not executed: the documentation states no expected output for this example.

$ raku argfiles.raku sonnet18.txt

Not executed: the documentation states no expected output for this example.

Shall I compare thee to a summer's day?

Not executed: the documentation states no expected output for this example.

sub MAIN () {
.say for $*ARGFILES.lines;
}

Not executed: the documentation states no expected output for this example.

sub MAIN () {
.say for $*IN.lines;
}

Not executed: the documentation states no expected output for this example.

for $*ARGFILES.handles -> $fh {
say $fh;
}

Not executed: the documentation states no expected output for this example.