[Catalyst] Suggestion for FastMmap related plugin handling
Ash Berlin
ash_cpan at firemirror.com
Sat Jul 21 22:11:42 GMT 2007
Seems like a bug in Cache::FastMmap. I'll get round to fixing it in my
fork (Cache::FastMmap::With::Win32) - that or get co-maint on the proper
one.
Fancy writing a me a failing test case against either CPAN'd modules?
apv wrote:
> 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
>
> _______________________________________________
> List: Catalyst at lists.rawmode.org
> Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
> Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
> Dev site: http://dev.catalyst.perl.org/
More information about the Catalyst
mailing list