Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Cannot pass boolean overloaded object as value to Type::Params named_to_list option #162

Open
XSven opened this issue Dec 6, 2024 · 3 comments

Comments

@XSven
Copy link

XSven commented Dec 6, 2024

I want to use true and false of the boolean module. I am running into trouble setting the Type::Params named_to_list option to true:

perl -Ilocal/lib/perl5 -Mboolean -MTypes::Standard=Str -MType::Params=signature -e'signature( named => [ name => Str ], named_to_list => true )'
Not an ARRAY reference at local/lib/perl5/Type/Params/Signature.pm line 742.

The problematic line is resumably L55.

@tobyink
Copy link
Owner

tobyink commented Dec 23, 2024

Yeah, I suppose I should change it to:

if ( $self->{named_to_list} and not is_ArrayRef $self->{named_to_list} ) {

@tobyink
Copy link
Owner

tobyink commented Dec 23, 2024

As a workaround, you could use:

named_to_list => ~~true

... which is kinda readable. Or if your Perl is recent enough:

named_to_list => builtin::true

@XSven
Copy link
Author

XSven commented Jan 8, 2025

The coercion attribute seems to have a similar deficit. You cannot say

coercion => true

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants