[Catalyst] Duplicate session ids

2007-05-25 Thread Bill Moseley
I fired up an older application today and couldn't log in.  I've
recently updated this machine, so not sure that's related.

Running Cat 5.7007 with current plugins:
'Session',
'Session::Store::FastMmap',
'Session::State::Cookie',

If I have this in my base class:

sub finalize_cookies {
my $c = shift;
$c->session->{foo};
return $c->NEXT::finalize_cookies( @_ );
}

Then I see this:

[debug] "GET" request for "foo" from "192.168.1.2"
[debug] Path is "foo"
[debug] Created session "c60bac05b858475180fd7ec87c136f39a0d864e5"
[debug] Created session "cb18f99367411577cf491e5d4b623704c177f1b4"

If I remove the $c->session{whatever} then I get:

sub finalize_cookies {
my $c = shift;
return $c->NEXT::finalize_cookies( @_ );
}


[debug] "GET" request for "foo" from "192.168.1.2"
[debug] Path is "foo"
[debug] Created session "3c23e190850ca9854d893f93b6ea20148fc24d61"


Wasn't there some issue with FastMmap recently?  I tried with 1.15 and
1.16.

1.16 didn't pass all tests:

t/6.NOK 6
#   Failed test 'leak test 128 > 30k'
#   in t/6.t at line 81.
t/6.ok 9/9# Looks like you failed 1 test of 9.   
t/6.dubious  
Test returned status 1 (wstat 256, 0x100)
DIED. FAILED test 6
Failed 1/9 tests, 88.89% okay
t/7.ok



-- 
Bill Moseley
[EMAIL PROTECTED]


___
List: Catalyst@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/


Re: [Catalyst] Catalyst and transactions

2007-05-25 Thread Jason Konrad

Thanks for the help.  With your suggestion I managed to track down what was 
going on.  The error I was seeing was coming from a unit test that I wrote 
using a mocked application (that someone else wrote).  It turns out that the 
$c->model method was being mocked and it would only return result sets.  I love 
testing...

So, yes, $c->model('kRadDB')->schema does work like it's supposed to.

-Jason


On 5/25/07 2:16 PM, "Evaldas Imbrasas" <[EMAIL PROTECTED]> wrote:

Try this:
$c->model('kRadDB')->result_source->schema

On 5/25/07, Jason Konrad <[EMAIL PROTECTED]> wrote:
> This does accomplish what I was trying to do but aren't there some
> connections around that I could use rather than manually connecting each
> time I need to do this transaction?
>
> $c->model('kRadDB')->schema
>
> I get this error " Can't call method "schema" without a package or object
> reference"

--
-
Evaldas Imbrasas
http://www.imbrasas.com

___
List: Catalyst@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/


___
List: Catalyst@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/


Re: [Catalyst] Two Strange Catalyst/Apache Issues

2007-05-25 Thread Randy J. Ray

On 5/25/07, Carl Johnstone <[EMAIL PROTECTED]> wrote:


> 
> use lib qw(/.../bylines); # This block only matters when the app is
> outside the default Perl areas
> 

Is that really what you have? ... probably is right, and you are missing
the
lib of the end of the path?



In this configuration, that is the directory that holds the start of the
module hierarchy. Bylines.pm is there, as are the Model, View and Controller
directories.

What continues to vex me, is that when I load the modules from one location,
everything loads and runs fine (my db problem has magically gone away,
even). But when I install them outside of the site_perl root, Catalyst tries
to explicitly load Bylines::Model::DB::Users, when ::DB::Users is a
plugged-in class from DBIC, that was created from Bylines::Model::DB being a
subclass of Catalyst::Model::DBIC::Schema and being configured with
schema_class.

Randy
--
Randy J. Ray / [EMAIL PROTECTED]
Campbell, CA
___
List: Catalyst@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/


Re: [Catalyst] Catalyst and transactions

2007-05-25 Thread Eden Cardim

On 5/25/07, Jason Konrad <[EMAIL PROTECTED]> wrote:

I got some help from the DBIx list today which helped me get the txn_do()
method working for my schema which is created with the loader

Schema
package kRadDB;

use strict;
use base qw/DBIx::Class::Schema::Loader/;

__PACKAGE__->loader_options(
relationships => 1,
);

The solution was to create a schema instance like so,

my $schema = kRadDB->connect(...);

Then do the transaction

$schema->txn_do($coderef);


This does accomplish what I was trying to do but aren't there some
connections around that I could use rather than manually connecting each
time I need to do this transaction?


You don't have to connect every time. Catalyst::Model::DBIC::Schema
connects when your catalyst application launches and does its best to
preserve the connection for you. You can get to the schema instance
via $c->model()


The docs for Catalyst-Model-DBIC-Schema say

# to access schema methods directly:
$c->model('FilmDB')->schema->source(...);


When I try a similar thing,

$c->model('kRadDB')->schema

I get this error " Can't call method "schema" without a package or object
reference"


You need to ask for the model name that inherits from
Catalyst::Model::DBIC::Schema, the one that has __PACKAGE__->config(
schema_class => 'kRadDB', config_info => '...' ) in it, not the schema
class.

--
Eden Cardim
Instituto Baiano de Biotecnologia
Núcleo de Biologia Computacional e Gestão de Informações Biotecnológicas
Laboratório de Bioinformática

___
List: Catalyst@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/


Re: [Catalyst] Catalyst and transactions

2007-05-25 Thread Eden Cardim

On 5/25/07, Eden Cardim <[EMAIL PROTECTED]> wrote:

You need to ask for the model name that inherits from
Catalyst::Model::DBIC::Schema, the one that has __PACKAGE__->config(
schema_class => 'kRadDB', config_info => '...' ) in it, not the schema
class.


oops, s/config/connect/

--
Eden Cardim
Instituto Baiano de Biotecnologia
Núcleo de Biologia Computacional e Gestão de Informações Biotecnológicas
Laboratório de Bioinformática

___
List: Catalyst@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/


Re: [Catalyst] Catalyst and transactions

2007-05-25 Thread Evaldas Imbrasas

Try this:
$c->model('kRadDB')->result_source->schema

On 5/25/07, Jason Konrad <[EMAIL PROTECTED]> wrote:

This does accomplish what I was trying to do but aren't there some
connections around that I could use rather than manually connecting each
time I need to do this transaction?

$c->model('kRadDB')->schema

I get this error " Can't call method "schema" without a package or object
reference"


--
-
Evaldas Imbrasas
http://www.imbrasas.com

___
List: Catalyst@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/


[Catalyst] Catalyst and transactions

2007-05-25 Thread Jason Konrad
I got some help from the DBIx list today which helped me get the txn_do()
method working for my schema which is created with the loader

Schema
package kRadDB;

use strict;
use base qw/DBIx::Class::Schema::Loader/;

__PACKAGE__->loader_options(
relationships => 1,
);

The solution was to create a schema instance like so,

my $schema = kRadDB->connect(...);

Then do the transaction

$schema->txn_do($coderef);


This does accomplish what I was trying to do but aren't there some
connections around that I could use rather than manually connecting each
time I need to do this transaction?

The docs for Catalyst-Model-DBIC-Schema say

# to access schema methods directly:
$c->model('FilmDB')->schema->source(...);


When I try a similar thing,

$c->model('kRadDB')->schema

I get this error " Can't call method "schema" without a package or object
reference"

Thanks for any advice/help,
 Jason


___
List: Catalyst@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/


Re: [Catalyst] Two Strange Catalyst/Apache Issues

2007-05-25 Thread Carl Johnstone


use lib qw(/.../bylines); # This block only matters when the app is
outside the default Perl areas



Is that really what you have? ... probably is right, and you are missing the 
lib of the end of the path?


We use:


   use lib qw(/path/to/CatProject/lib/);



Carl



___
List: Catalyst@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/