[Dbix-class] Setting LongReadLen for catalyst session

Jason Gottshall jgottshall at capwiz.com
Tue Aug 28 21:15:30 GMT 2007


My Catalyst session table uses a CLOB field (Oracle) to store the
session data, so at some point I need to set $dbh->{LongReadLen} to a
reasonable value. I found a place in
Catalyst::Plugin::Session::Store::DBIC where I can check for a config
value and set LongReadLen locally. Here's a diff -u:

  --- DBIC.pm 2006-09-16 15:36:27.000000000 -0400
  +++ DBIC_new.pm 2007-08-28 14:47:40.000000000 -0400
  @@ -191,6 +191,20 @@
       return ($accessor, @args);
   }
  
  +=head2 get_session_data
  +
  +Retrieve the specified session from the backend store, setting
  +$dbh->{LongReadLen} according to the C<maxlength> value in config.
  +
  +=cut
  +
  +sub get_session_data {
  +    my ( $c, $key ) = @_;
  +    local
$c->session_store_delegate->model->result_source->storage->dbh
  +        ->{LongReadLen} = $c->config->{session}->{maxlength} || 0;
  +    return $c->NEXT::get_session_data($key);
  +}
  +
   =head2 delete_session_data
  
   Delete the specified session from the backend store.

Any thoughts? Is the plugin maintainer on this list, or should I
cross-post to the Catalyst list?

Thanks,
Jason



More information about the DBIx-Class mailing list