Skip Menu |

This queue is for tickets about the Params-Validate CPAN distribution.

Report information
The Basics
Id: 79718
Status: rejected
Priority: 0/
Queue: Params-Validate

People
Owner: Nobody in particular
Requestors: FGA [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: 1.06
Fixed in: (no value)



Hello, I would like to have a "delete_matching" option, which when coupled with "allow_extra", would allow easy currying of parameters, for example: # in class P sub new { my $class = shift; my %params_for_parent = validate_with( params => \@_, spec => { child_class => ..., foo => ..., }, allow_extra => 1, delete_matching => 1); # do stuff with foo # pass on unused parameters return $params_for_parent{child_class}->new(@_); } # in class C extends P sub new { my $class = shift; my %params_for_child = validate_with( params => \@_, # doesn't have foo spec => { bar => ..., }); # do stuff with self and bar return bless $self, $class; } I don't really like the "delete_matching" name but I haven't found anything better, if you have a suggestion? Maybe a single "curry_unused" option instead, that would set "allow_extra" and do the job of "delete_matching". Finer control should remain possible in case both P and C want to use "foo". If the above change is OK with you, I'm willing to start working on it.
I'm no longer going to make any non-bugfix changes to P::V so I'm closing old wishlist tickets. See https://metacpan.org/pod/Params::ValidationCompiler for a better parameter validation tool.