Subject: | Documentation issue and/or bug with compile_named+head+named_to_list? |
Hi,
I'm confused about the documentation of compile_named: the last three examples in its docs (right before the docs of validate_named) show the use of `compile` instead of `compile_named`, and I assume as a result, those code examples don't appear to work.
If I take the last example demonstrating the use of `head` and `named_to_list`, and I change the `compile` to `compile_named`, I get a bunch of errors, attached. Is this a bug in the code, or perhaps the documentation?
Thanks,
-- Hauke D
Subject: | t.pl |
#!/usr/bin/env perl
use warnings;
use strict;
use Type::Params qw/ compile_named /;
use Types::Standard qw/ Int Str CodeRef /;
my $check = compile_named(
{ head => [ Int, Int ], tail => [ CodeRef ], named_to_list => 1 },
foo => Str,
bar => Str,
baz => Str,
);
my ($int1, $int2, $foo, $bar, $baz, $coderef)
= $check->( 666, 999, foo=>'x', bar=>'y', baz=>'z', sub {} );
print $bar;
__END__
Failed to compile source because: syntax error at parameter validation for '__ANON__' line 25, near "}
unshift"
Global symbol "@R" requires explicit package name (did you forget to declare "my @R"?) at parameter validation for '__ANON__' line 25.
Global symbol "@R" requires explicit package name (did you forget to declare "my @R"?) at parameter validation for '__ANON__' line 26. at t.pl line 7.