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

Report information
The Basics
Id:
29762
Status:
rejected
Priority:
Low/Low

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

BugTracker
Severity:
Normal
Broken in:
0.88
Fixed in:
(no value)



Subject: Trapping Repeated Arguments
We've just encountered a situation where Params::Validate permitted some obviously invalid data. Somebody tried to pass the same parameter multiple times to a function; it was actually an attempt to mail several users at once, doing something along the lines of: send_mail subject => 'Hi', to => 'Compo', to => 'Clegg', from => $me; Unsurprisingly what actually happens is that all but the last-mentioned 'to' parameter is ignored; the above is treated identically to: send_mail subject => 'Hi', to => 'Clegg', from => $me; We're using Params::Validate on the function, but unfortunately it doesn't complain about this situation. CPAN #26018 makes it clear that this isn't something that should be permitted. The attached patch adds a failing test case which demonstrates the situation (though not the code to fix it).
Subject: multiple_params_t.diff
diff -ur Params-Validate-0.88-QQCxXQ/t/01-validate.t Params-Validate-0.88-whm3NS/t/01-validate.t --- Params-Validate-0.88-QQCxXQ/t/01-validate.t Sat Jan 21 17:57:25 2006 +++ Params-Validate-0.88-whm3NS/t/01-validate.t Tue Oct 2 16:45:05 2007 @@ -15,6 +15,7 @@ q|^Mandatory parameter 'bar' missing|, q|^Mandatory parameters .* missing|, q|^The following parameter .* baz|, + q|^Multiple parameter 'bar' supplied|, 0, 0, 0, diff -ur Params-Validate-0.88-QQCxXQ/t/tests.pl Params-Validate-0.88-whm3NS/t/tests.pl --- Params-Validate-0.88-QQCxXQ/t/tests.pl Sat Jan 21 17:57:25 2006 +++ Params-Validate-0.88-whm3NS/t/tests.pl Tue Oct 2 16:47:17 2007 @@ -2,7 +2,7 @@ use Params::Validate qw(:all); -print "1..97\n"; +print "1..98\n"; $| = 1; @@ -20,6 +20,9 @@ check(); eval { sub1( foo => 'a', bar => 'b', baz => 'c' ) }; + check(); + + eval { sub1( foo => 'a', bar => 'b', bar => 'c' ) }; check(); eval { sub2( foo => 'a', bar => 'b', baz => 'c' ) };
I'm no longer going to make any non-bugfix changes to P::V so I'm closing old wishlist tickets.


This service runs on Request Tracker, is sponsored by The Perl Foundation, and maintained by Best Practical Solutions.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.