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?
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 :-)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With