[Catalyst] Suggestion for FastMmap related plugin handling
apv
apv at sedition.com
Sat Jul 21 21:47:55 GMT 2007
I got a small bite by unexpected behavior when setting the storage
source for CP::Session::Store::FastMmap with path_to().
I went from using a static string to a path_to representing the
identical path and it broke the storage. It also, I think, fails
silently in the case of CP::Cache::FastMmap.
It took a minute to realize that path_to is returning a Class::Path
object. This stringifies fine most of the time but I think b/c
FastMmap has underlying C code it doesn't know what to do with the
path_to object (just a guess).
This is broken silently:
cache => {
backend => {
store => 'FastMmap',
share_file => __PACKAGE__->path_to('tmp', 'another_cache'),
},
},
This is broken fatally:
session => {
storage => __PACKAGE__->path_to('tmp', 'cache_name'),
},
While these work fine:
cache => {
backend => {
store => 'FastMmap',
share_file => __PACKAGE__->path_to('tmp',
'another_cache')->stringify,
},
},
session => {
storage => __PACKAGE__->path_to('tmp', 'cache_name')-
>stringify,
},
Would it be a good idea to change the
Catalyst::Plugin::Session::FastMmap::setup() to quote sources?
I couldn't easily see where it *might* benefit from a change in
CP::Cache.
sub setup {
my $self = shift;
### $self->config->{session}->{storage} ||= '/tmp/session';
my $storage = $self->config->{session}->{storage} || '/tmp/
session'; # NEW
$self->config->{session}->{expires} ||= 60 * 60 * 24;
$self->config->{session}->{rewrite} ||= 0;
$self->_session(
Cache::FastMmap->new(
### share_file => $self->config->{session}->{storage},
share_file => "$storage", # NEW
expire_time => $self->config->{session}->{expires}
)
);
return $self->NEXT::setup(@_);
}
-Ashley
More information about the Catalyst
mailing list