Skip Menu |

This queue is for tickets about the Catalyst-Plugin-Session-Store-MongoDB CPAN distribution.

Report information
The Basics
Id: 105639
Status: resolved
Priority: 0/
Queue: Catalyst-Plugin-Session-Store-MongoDB

People
Owner: rjk [...] tamias.net
Requestors: ZARQUON [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: 0.03



Subject: Config is incompatible with MongoDB::Connection interface leading to the strong possiblity of confusion
Patch attached. For glue modules like this it's a reasonable assumption that both sides of the interface fit. In this case I see why this was ommitted (a host method in the session store causes test failures), so here's a patch for an implementation that doesn't mess with the moose attributes
Subject: accessor_bug.diff
diff --git a/lib/Catalyst/Plugin/Session/Store/MongoDB.pm b/lib/Catalyst/Plugin/Session/Store/MongoDB.pm index c62d5ed..b8b6983 100644 --- a/lib/Catalyst/Plugin/Session/Store/MongoDB.pm +++ b/lib/Catalyst/Plugin/Session/Store/MongoDB.pm @@ -2,7 +2,7 @@ package Catalyst::Plugin::Session::Store::MongoDB; use strict; use warnings; -our $VERSION = '0.02'; +our $VERSION = '0.03'; use Moose; use namespace::autoclean; @@ -64,7 +64,10 @@ sub _cfg_or_default { sub _build_hostname { my ($self) = @_; - return $self->_cfg_or_default('hostname', 'localhost'); + # keep it compatible with the host => $host entry in MongoDB::Connection + my ($hostname_accessor) = grep { $_ =~ /^(?:host|hostname)$/ } + keys %{$self->_session_plugin_config}; + return $self->_cfg_or_default($hostname_accessor, 'localhost'); } sub _build_port { @@ -196,7 +199,9 @@ In your MyApp.pm: and in your MyApp.conf <Plugin::Session> - hostname foo # defaults to localhost + hostname foo # defaults to localhost, can also use host + # for a compatible interface with + # MongoDB::Connection port 0815 # defaults to 27017 dbname test # defaults to catalyst collectionname s2 # defaults to session
Now has a client_options attribute, a hash which is passed directly to MongoDB::MongoClient->new(). hostname and port are deprecated.