Thanks, Timo and Moritz.
> Because say() is a high-level function that uses the lower-level
> $*OUT.print under the hood.
Ah, so an alternative would be to just redefine the sub:
my $str = '';
sub say($arg) {
$str ~= $arg
}
say 'hi';
use Test;
is $str, 'hi', 'works';
Works g
Hi Brian,
On 24.01.2017 23:28, Brian Duggan wrote:
> Hi All,
>
> This code:
>
> my $str = '';
> class Mock {
> method say($arg) { $str ~= $arg }
> }
> $*OUT = Mock.new;
> say 'hi';
>
> produces:
>
> Too many positionals passed; expected 1 argument but got 2
> in block at o
You're getting a stack trace that's missing the helpful bits, because
they go through the core setting, and our default backtrace printer
skips those.
You can get the vital information you need by supplying --ll-exception
directly after perl6. It'll show you that calling the sub "say" will
grab $*
Hi All,
This code:
my $str = '';
class Mock {
method say($arg) { $str ~= $arg }
}
$*OUT = Mock.new;
say 'hi';
produces:
Too many positionals passed; expected 1 argument but got 2
in block at out.p6 line 6
Changing the signature of say doesn't seem to help.
If I change 'sa