This queue is for tickets about the CHI CPAN distribution.

Report information
The Basics
Id:
48988
Status:
resolved
Priority:
Low/Low
Queue:

People
Owner:
Nobody in particular
Requestors:
cpan [...] bambra.net
Cc:
AdminCc:

BugTracker
Severity:
Important
Broken in:
0.26
Fixed in:
0.28



Subject: CHI::Driver->get works incorrectly in some cases
When `get` method takes data from @_ (this happens, for example, in `get_multi`), it will return nothing if some eval before this will fail. Code illustrating this problem is below. use CHI; use Data::Dumper; my $c = CHI->new(driver => 'File', root_dir => '/tmp/test_chi'); $c->set('test' => 'value'); eval { die "Test"; }; print Dumper($c->get_multi_hashref([ 'test' ])); The reason is that `get` checks for $@ even if it didn't call for `eval { $self->fetch }`, as usual. Patch for CHI/Driver.pm is attached, I'm sure it is clear. Feel free to contact me in case of questions.
Subject: CHI_Driver_pm.patch
133,137c133,139 < my $data = $params{data} || eval { $self->fetch($key) }; < if ( my $error = $@ ) { < $self->_handle_get_error( $error, $key ); < return; < } --- > unless ( exists $params{data} ) { > $params{data} = eval { $self->fetch($key) }; > if ( my $error = $@ ) { > $self->_handle_get_error( $error, $key ); > return; > } > } 140c142 < if ( !defined $data ) { --- > if ( !defined $params{data} ) { 146c148 < CHI::CacheObject->unpack_from_data( $key, $data, $self->serializer ); --- > CHI::CacheObject->unpack_from_data( $key, $params{data}, $self->serializer );


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.