Subject: | CHI::Types using wrong parameter for DiscardPolicy |
Date: | Fri, 2 May 2014 11:07:50 -0700 |
To: | bug-CHI [...] rt.cpan.org |
From: | Josh Rosenbaum <josh [...] ziprecruiter.com> |
For CHI 0.58.
The attached patch fixes the DiscardPolicy type by using the correct
parameter ($_[0]) rather than the $_ variable.
This bug is triggered when:
*) maximum size of cache is reached
and
*) $_ is a ref, but not a code ref.
I'm guessing it hasn't been noticed so far, because that set of conditions
limits the scope of the issue for many cases.
--- /usr/local/share/perl/5.14.2/CHI/Types.pm 2013-07-21
07:22:39.000000000 -0700
+++ CHI/Types.pm 2014-05-02 10:44:33.300836594 -0700
@@ -37,7 +37,7 @@
},
{
name => 'DiscardPolicy',
- test => sub { !ref($_) || ref($_) eq 'CODE' },
+ test => sub { !ref($_[0]) || ref($_[0]) eq 'CODE' },
message => sub { return exception_message($_[0], 'a coderef or policy
name') },
inflate => 0,
},
Cheers,
-- Josh Rosenbaum
Message body is not shown because sender requested not to inline it.