Skip Menu |

This queue is for tickets about the CHI CPAN distribution.

Report information
The Basics
Id: 76489
Status: resolved
Priority: 0/
Queue: CHI

People
Owner: Nobody in particular
Requestors: vitaliy.tokarev [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.52
Fixed in: (no value)



Subject: CHI::Driver::File typo in get_keys() function
Micro patch, no comments: --- /home/tvv/.staticperl/cpan/build/CHI-0.52-WWxqXK/lib/CHI/Driver/ File.pm 2012-03-08 11:58:09.000000000 +0400 +++ /home/tvv/.staticperl/lib/CHI/Driver/File.pm 2012-04-11 12:41:10.000000000 +0400 @@ -138,7 +138,8 @@ sub get_keys { my ($self) = @_; my @filepaths; - my $wanted = sub { push( @filepaths, $_ ) if -f && /\.dat$/ }; + my $re = quotemeta($self->file_extension); + my $wanted = sub { push( @filepaths, $_ ) if -f && /${re}$/ }; my @keys = $self->_collect_keys_via_file_find( \@filepaths, $wanted ); return @keys; }
From: vitaliy.tokarev [...] gmail.com
The previous patch is incomplete, I forgot to check it, sorry. New version, it was tested and must works properly now: --- /home/tvv/.staticperl/cpan/build/CHI-0.52-WWxqXK/lib/CHI/Driver/ File.pm 2012-03-08 11:58:09.000000000 +0400 +++ /home/tvv/.staticperl/lib/CHI/Driver/File.pm 2012-04-11 12:56:30.000000000 +0400 @@ -138,7 +138,8 @@ sub get_keys { my ($self) = @_; my @filepaths; - my $wanted = sub { push( @filepaths, $_ ) if -f && /\.dat$/ }; + my $re = quotemeta($self->file_extension); + my $wanted = sub { push( @filepaths, $_ ) if -f && /${re}$/ }; my @keys = $self->_collect_keys_via_file_find( \@filepaths, $wanted ); return @keys; } @@ -154,7 +155,7 @@ sub _collect_keys_via_file_find { my @keys; my $key_start = length($namespace_dir) + 1 + $self->depth * 2; foreach my $filepath (@$filepaths) { - my $key = substr( $filepath, $key_start, -4 ); + my $key = substr( $filepath, $key_start, -length($self- Show quoted text
>file_extension) );
$key = $self->unescape_key( join( "", splitdir($key) ) ); push( @keys, $key ); }
Subject: Re: [rt.cpan.org #76489] CHI::Driver::File typo in get_keys() function
Date: Thu, 12 Apr 2012 10:06:57 -0700
To: bug-CHI [...] rt.cpan.org
From: Jonathan Swartz <swartz [...] pobox.com>
Thanks Vitaliy! Will be in next release. On Apr 11, 2012, at 2:00 AM, Vitaliy Tokarev via RT wrote: Show quoted text
> Queue: CHI > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=76489 > > > The previous patch is incomplete, I forgot to check it, sorry. New > version, it was tested and must works properly now: > > --- /home/tvv/.staticperl/cpan/build/CHI-0.52-WWxqXK/lib/CHI/Driver/ > File.pm 2012-03-08 11:58:09.000000000 +0400 > +++ /home/tvv/.staticperl/lib/CHI/Driver/File.pm 2012-04-11 > 12:56:30.000000000 +0400 > @@ -138,7 +138,8 @@ sub get_keys { > my ($self) = @_; > > my @filepaths; > - my $wanted = sub { push( @filepaths, $_ ) if -f && /\.dat$/ }; > + my $re = quotemeta($self->file_extension); > + my $wanted = sub { push( @filepaths, $_ ) if -f && /${re}$/ }; > my @keys = $self->_collect_keys_via_file_find( \@filepaths, > $wanted ); > return @keys; > } > @@ -154,7 +155,7 @@ sub _collect_keys_via_file_find { > my @keys; > my $key_start = length($namespace_dir) + 1 + $self->depth * 2; > foreach my $filepath (@$filepaths) { > - my $key = substr( $filepath, $key_start, -4 ); > + my $key = substr( $filepath, $key_start, -length($self-
>> file_extension) );
> $key = $self->unescape_key( join( "", splitdir($key) ) ); > push( @keys, $key ); > } >