5

In order to fix this error I would need to re-cast $*ARGFILES as a IO::CatHandle, since it uses some attributes of that class. I'm trying this:

use IO::CatHandle::AutoLines; # -*- mode:perl6 -*-
use Test;

if $*ARGFILES === $*IN {
    $*ARGFILES = IO::CatHandle.new( $*IN );
}
eval-lives-ok "$*ARGFILES does IO::CatHandle::AutoLines", "Can recast \$*ARGFILES";

But this yields the error:

# Error: Unsupported use of <STDIN>; in Perl 6 please use $*IN.lines (or add whitespace to suppress warning)

This is independent, I think, of the role I'm mixing, but I add it for context. Any idea of what else could be done?

jjmerelo
  • 22,578
  • 8
  • 40
  • 86

1 Answers1

11

The error you see is very LTA, but a side-effect of using double quotes, when you should have been using single quotes:

eval-lives-ok '$*ARGFILES does IO::CatHandle::AutoLines',
  "Can recast \$*ARGFILES";
# ok 1 - Can recast $*ARGFILES

So you're trying to stringify $*ARGFILES, which yields the string:

<STDIN> does IO::CatHandle::AutoLines

and that does not EVAL very well :-)

Elizabeth Mattijsen
  • 25,654
  • 3
  • 75
  • 105