[Catalyst] Catalyst::Plugin::Session::ApacheSession

toddrw69 at excite.com toddrw69 at excite.com
Tue Mar 15 18:01:53 CET 2005


aside: can we get gmane to pick up this mailing list? nntp is so much nicer for me. If the list admin could fill out the form at http://gmane.org/subscribe.php, I for one would be able to participate much more productively.



I have written Catalyst::Plugin::Session::ApacheSession, please download and review it while I wait for my PAUSE id.



http://waveright.homeip.net/~trwww/code/Catalyst-Plugin-Session-ApacheSession-0.01.tar.gz



Perrin had some questions about it, they are quoted and answered here.



 --- On Tue 03/15, Perrin Harkins < perrin at elem.com > wrote:

> On Tue, 2005-03-15 at 10:08 -0500, toddrw69 at excite.com wrote:

>> I'll name it Catalyst::Plugin::Session::ApacheSession unless anyone

>> has any objections.



> Does it support any Apache::Session class, or just MySQL? You might

> consider having it use Apache::Session::Wrapper instead, to make it

> easy to support all classes. Maybe that could be something for a 

> future version.



What I did to keep it simple so I can start building my apps yet share the code was force the user to use() the session module they want to use in the application and have them specify the options in the config:



    use Apache::Session::MySQL;

    use Catalyst 'Session::ApacheSession';



    MyApp->config(

      session => {

        class => 'Apache::Session::MySQL',

        Handle => $dbh,

        LockHandle => $dbh,

      }

    );



And then the code in C::P::S::ApacheSession is nearly identical to C::P::S::FastMmap except the setup sub looks like this:



sub setup {

    my $self      = shift;

    my $a_s_class = delete($self->config->{session}{class});

    my $s_config  = $self->config->{session};

    tie my %hash, $a_s_class, undef, $s_config;

    $self->_session( \%hash );

    return $self->NEXT::setup(@_);

}



This way, any Apache::Session::* will work, its reuseable, and I should be able to make it backwards compatible with anything else we add later.



I wanted to use Apache::Session::Flex, but I dont have time right now doing sanity checks and setting defaults.



I didnt know about Apache::Session::Wrapper, I see that it wraps Apache::Session::Flex, but Im about out of time for this right now.



Todd W.



_______________________________________________
Join Excite! - http://www.excite.com
The most personalized portal on the Web!



More information about the Catalyst mailing list