CC: | forrest.cahoon [...] gmail.com |
Subject: | Error in purge |
I don't know too much about CHI internals, but once I upgraded to 0.36 I
had a problem with purge() in some code I maintain
Can't call is_expired() on an undefined value
I added a definedness test which fixed the problem: here's the patch
--- Driver.pm.bk 2010-12-07 07:30:57.000000000 -0600
+++ Driver.pm 2010-12-07 07:39:59.000000000 -0600
@@ -403,7 +403,7 @@
my ($self) = @_;
foreach my $key ( $self->get_keys() ) {
- if ( $self->get_object($key)->is_expired() ) {
+ if ( defined $self->get_object($key) &&
$self->get_object($key)->is_expired() ) {
$self->remove($key);
}
}
I'm not sure that's the "right" way to fix the issue, but it works.