FAQ
Firstly, this was working on the train this morning (before I upgraded
to the 5.7000 release).
Secondly, yes I should have upgraded to a -dev version and tested this
before now.

Right, onto the problem.

I have:

--------
package Parley::Model::ParleyDB::Post;
...
sub last_post_in_list {
...
}
...
1;
--------

and in Parley::Controller::Thread I have:

--------
$last_post = $c->model('ParleyDB')->table('post')->last_post_in_list(
$c->stash->{post_list}
);
--------

Up until this morning, the call worked just fine, however since
upgrading to 5.7000 I'm getting the application debug screen with the
following error:
--------
Caught exception in Parley::Controller::Thread->view "Can't locate
object method "last_post_in_list" via package
"Parley::Model::ParleyDB::Post" at
/home/chisel/development/svk/parley/script/../lib/Parley/Controller/Thread.pm
line 74."
--------

I've added a can_ok() test t/model_Parley-Post.t which passes with
last_post_in_list in the function list.


I'm not using Schema stuff (yet), I'd like to move in that direction,
but I haven't taken the time to find out how to do this yet. At the
moment I have:

--------
package Parley::Model::ParleyDB;
use strict;
use base 'Catalyst::Model::DBIC';

__PACKAGE__->config(
dsn => 'dbi:Pg:dbname=parley',
user => 'parley',
password => undef,
options => {
AutoCommit => 1,
},
relationships => 1,

debug => 0,
);
--------


The only thing that's changed since I got off the train this morning is
my upgrade to 5.7. Any ideas?

Chisel
--
Chisel Wright
e: chisel at herlpacker.co.uk
w: http://www.herlpacker.co.uk/

This is not an automated signature. I type this in to the bottom of every
message.

Search Discussions

  • Chisel Wright at Jul 11, 2006 at 9:51 am

    On Mon, Jul 10, 2006 at 02:42:22PM +0100, Chisel Wright wrote:
    The only thing that's changed since I got off the train this morning is
    my upgrade to 5.7. Any ideas?
    This morning I decided to boil my problem down to a simpler test-case
    (attached), to make it easier to demonstrate/test my problem.

    This morning I copied the test across to another box, running 5.61,
    where they pass.

    I then did:

    cpan Catalyst::Devel
    cpan Catalyst

    and re-ran the test, which failed, the same as on my laptop.

    Do I have a corrupt install after upgrading, or is this a bug?


    I've attached the files that should be required for testing.


    Chisel
    --
    Chisel Wright
    e: chisel at herlpacker.co.uk
    w: http://www.herlpacker.co.uk/

    This is not an automated signature. I type this in to the bottom of every
    message.
    -------------- next part --------------
    1. Create database

    createdb -E UTF8 classmethod
    psql -d classmethod -f db/classmethod.sql

    2. Create DB Model

    ./script/classmethod_create.pl model CMDB DBIC dbi:Pg:dbname=classmethod

    3. Add a method to the ClassMethod class

    vi ./lib/ClassMethod/Model/CMDB/ClassMethod.pm

    # add:
    sub some_method {
    my $self = shift;
    return 1;
    }

    4. Add a call to the default controller

    vi ./lib/ClassMethod/Controller/Root.pm

    # add to sub default():
    $c->model('CMDB')->table('class_method')->some_method();

    5. Add a test

    vi ./t/model_CMDB-ClassMethod.t

    # increase number of tests to 3
    # add following test:
    can_ok('ClassMethod::Model::CMDB::ClassMethod', qw/ some_method /);

    6. Run the test

    prove --lib --verbose t/model_CMDB-ClassMethod.t

    All tests should pass, we're specifically interested in:

    ok 3 - ClassMethod::Model::CMDB::ClassMethod->can('some_method')

    7. Run the application

    ./script/classmethod_test.pl / 2>&1 |grep 'class="error"'

    If there are any application errors, you'll see them, otherwise you'll see nothing.


    8. Drop database

    dropdb classmethod
    -------------- next part --------------
    -- createdb -E UTF 8 classmethod

    BEGIN;

    CREATE TABLE class_method (
    id SERIAL primary key,
    int1 integer default 1,
    text1 text default 'one'
    );

    COMMIT;
    -------------- next part --------------
    chisel at ferrari ClassMethod $ prove --lib --verbose t/model_CMDB-ClassMethod.t
    t/model_CMDB-ClassMethod....1..3
    [debug] Debug messages enabled
    [debug] Loaded plugins:
    .----------------------------------------------------------------------------.
    Catalyst::Plugin::ConfigLoader 0.06 |
    Catalyst::Plugin::Static::Simple 0.14 |
    '----------------------------------------------------------------------------'

    [debug] Loaded dispatcher "Catalyst::Dispatcher"
    [debug] Loaded engine "Catalyst::Engine::CGI"
    [debug] Found home "/home/chisel/development/svk/parley/issues/model_method/ClassMethod"
    [debug] Loaded tables "class_method"
    [debug] Loaded components:
    .-----------------------------------------------------------------+----------.
    Class | Type |
    +-----------------------------------------------------------------+----------+
    ClassMethod::Controller::Root | instance |
    ClassMethod::Model::CMDB | instance |
    ClassMethod::Model::CMDB::ClassMethod | class |
    ClassMethod::Model::CMDB::_db | class |
    '-----------------------------------------------------------------+----------'

    [debug] Loaded Private actions:
    .----------------------+--------------------------------------+--------------.
    Private | Class | Method |
    +----------------------+--------------------------------------+--------------+
    /default | ClassMethod::Controller::Root | default |
    /end | ClassMethod::Controller::Root | end |
    '----------------------+--------------------------------------+--------------'

    [info] ClassMethod powered by Catalyst 5.7000
    ok 1 - use Catalyst::Test;
    ok 2 - use ClassMethod::Model::CMDB::ClassMethod;
    ok 3 - ClassMethod::Model::CMDB::ClassMethod->can('some_method')
    ok
    All tests successful.
    Files=1, Tests=3, 1 wallclock secs ( 1.12 cusr + 0.14 csys = 1.26 CPU)




    chisel at ferrari ClassMethod $ ./script/classmethod_test.pl / 2>&1 |grep 'class="error"'
    <div class="error"><pre wrap=""><p><code class="error">Caught exception in ClassMethod::Controller::Root-&gt;default &quot;Can&#39;t locate object method &quot;some_method&quot; via package &quot;ClassMethod::Model::CMDB::ClassMethod&quot; at /home/chisel/development/svk/parley/issues/model_method/ClassMethod/script/../lib/ClassMethod/Controller/Root.pm line 32.&quot;</code></p></pre></div>
    chisel at ferrari ClassMethod $
  • Ash Berlin at Jul 11, 2006 at 10:05 am

    Chisel Wright wrote:
    On Mon, Jul 10, 2006 at 02:42:22PM +0100, Chisel Wright wrote:

    The only thing that's changed since I got off the train this morning is
    my upgrade to 5.7. Any ideas?
    This morning I decided to boil my problem down to a simpler test-case
    (attached), to make it easier to demonstrate/test my problem.

    This morning I copied the test across to another box, running 5.61,
    where they pass.

    I then did:

    cpan Catalyst::Devel
    cpan Catalyst

    and re-ran the test, which failed, the same as on my laptop.

    Do I have a corrupt install after upgrading, or is this a bug?


    I've attached the files that should be required for testing.


    Chisel
    What about Catalyst::Runtime?
  • Chisel Wright at Jul 11, 2006 at 10:05 am

    On Tue, Jul 11, 2006 at 11:05:58AM +0100, Ash Berlin wrote:
    What about Catalyst::Runtime?
    root at erato:~# cpan Catalyst::Runtime
    CPAN: Storable loaded ok
    Going to read /root/.cpan/Metadata
    Database was generated on Mon, 10 Jul 2006 07:29:23 GMT
    Catalyst::Runtime is up to date.

    chiselw at erato:~/model_method/ClassMethod$ perl -MCatalyst::Runtime -le \
    'print Catalyst::Runtime->VERSION;'
    5.7000

    --
    Chisel Wright
    e: chisel at herlpacker.co.uk
    w: http://www.herlpacker.co.uk/

    This is not an automated signature. I type this in to the bottom of every
    message.
  • Chisel Wright at Jul 13, 2006 at 10:30 am

    On Tue, Jul 11, 2006 at 10:51:15AM +0100, Chisel Wright wrote:
    Do I have a corrupt install after upgrading, or is this a bug?
    OK, I've tried this on:

    Ubuntu, upgraded catalyst
    Gentoo, upgraded catalyst
    Ubuntu, totally fresh install, fresh catalyst

    All three fail to locate the ::Model::Class object method running under
    the Catalyst server/test scripts.

    Is anyone else using 5.7 and models with extra user-defined functions?

    I'm just surprised that this seems to be happening everywhere for me,
    and no-one else seems to have any problem.


    Does anyone have 5-10 minutes to try the test(s) I outlined in my
    previous message?

    Chisel
    --
    Chisel Wright
    e: chisel at herlpacker.co.uk
    w: http://www.herlpacker.co.uk/

    This is not an automated signature. I type this in to the bottom of every
    message.
  • Ash Berlin at Jul 13, 2006 at 11:49 am

    Chisel Wright wrote:
    On Tue, Jul 11, 2006 at 10:51:15AM +0100, Chisel Wright wrote:

    Do I have a corrupt install after upgrading, or is this a bug?
    OK, I've tried this on:

    Ubuntu, upgraded catalyst
    Gentoo, upgraded catalyst
    Ubuntu, totally fresh install, fresh catalyst

    All three fail to locate the ::Model::Class object method running under
    the Catalyst server/test scripts.

    Is anyone else using 5.7 and models with extra user-defined functions?

    I'm just surprised that this seems to be happening everywhere for me,
    and no-one else seems to have any problem.


    Does anyone have 5-10 minutes to try the test(s) I outlined in my
    previous message?

    Chisel
    I haven't actually run your test since I don't have Pg installed.

    A few things tho:

    1) You should really think about converting to DBIC::Schema instead.
    2) What version were you upgrading from?
    3) Did you also upgrade anything else?

    And the key thing here:

    4) You probably want some_method to be a method on the result_set: i.e.
    something like the following:
    http://search.cpan.org/~jrobinson/DBIx-Class-0.06003/lib/DBIx/Class/ResultSetManager.pm

    Ash
  • Chisel Wright at Jul 13, 2006 at 1:41 pm

    On Thu, Jul 13, 2006 at 12:49:21PM +0100, Ash Berlin wrote:
    1) You should really think about converting to DBIC::Schema instead.
    Yes, I'd like to, but I have no idea where to start.
    2) What version were you upgrading from?
    Um, 5.6x, in the cases where I upgraded and didn't install on a fresh
    box.
    3) Did you also upgrade anything else?
    I just did:
    install Catalyst
    install Catalyst::Devel

    I wasn't watching that closely, but I'm sure CPAN upgraded Other
    Stuff/dependencies
    4) You probably want some_method to be a method on the result_set: i.e.
    something like the following:
    http://search.cpan.org/~jrobinson/DBIx-Class-0.06003/lib/DBIx/Class/ResultSetManager.pm
    I'll look into that.


    --
    Chisel Wright
    e: chisel at herlpacker.co.uk
    w: http://www.herlpacker.co.uk/

    This is not an automated signature. I type this in to the bottom of every
    message.
  • Will Hawes at Jul 13, 2006 at 2:19 pm

    Chisel Wright wrote:
    On Thu, Jul 13, 2006 at 12:49:21PM +0100, Ash Berlin wrote:
    1) You should really think about converting to DBIC::Schema instead.
    Yes, I'd like to, but I have no idea where to start.
    The number of users still using a class-based approach must be very
    small by now so I think you'd have a better chance of getting this fixed
    by switching to Schema.

    I fretted for quite a while about switching, thinking it must be
    terribly complicated. IIRC it was about as difficult as making the base
    model class inherit from Schema and changing "use base" in the other
    classes and took me about 20 minutes. It also improved the startup time
    of my app by several orders of magnitude.

    You should find what you need at
    http://search.cpan.org/dist/DBIx-Class/lib/DBIx/Class/Manual/Intro.pod.
  • Brandon Black at Jul 13, 2006 at 7:14 pm
    Sorry for not responding to the thread sooner, but I've been busy the
    past few days. The underlying issue causing this regression has been
    identified and worked on a bit, I've posted a failing testcase to
    #catalyst-dev, etc. Its just a question of exactly what or how to do
    about it that's a bit complicated AFAIK - I haven't followed up on
    this in the past day or two to see what the final fallout was.

    The true nature of the issue is that in previous Catalyst releases, if
    your Model directory contained Foo.pm and Foo/Bar.pm, Catalyst itself
    would always load both files, without question. In the release's way
    of handling the component loading, Foo.pm is always loaded first, and
    if it defines a "Foo::Bar" namespace, then Foo/Bar.pm won't get loaded
    by Catalyst (it assumes Foo.pm must have loaded it, basically).

    Some usages of some Models (in theory even DBIC::Schema, but the
    pattern is probably rare to nonexistant) rely on this older behavior
    to load layered "additional" definitions on top of Loader-generated
    in-memory definitions.

    -- Brandon
  • Matt S Trout at Jul 14, 2006 at 2:03 am

    On 13 Jul 2006, at 11:30, Chisel Wright wrote:
    On Tue, Jul 11, 2006 at 10:51:15AM +0100, Chisel Wright wrote:
    Do I have a corrupt install after upgrading, or is this a bug?
    OK, I've tried this on:

    Ubuntu, upgraded catalyst
    Gentoo, upgraded catalyst
    Ubuntu, totally fresh install, fresh catalyst

    All three fail to locate the ::Model::Class object method running
    under
    the Catalyst server/test scripts.
    It's a bug. Shame nobody using a setup like yours can have tested the
    dev releases like we asked.

    For the moment you can work around it by require-ing the classes
    after MyApp->setup, I think; a fix should be going into trunk for
    testing tomorrow.

    --
    Matt S Trout, Technical Director, Shadowcat Systems Ltd.
    Offering custom development, consultancy and support contracts for
    Catalyst,
    DBIx::Class and BAST. Contact mst (at) shadowcatsystems.co.uk for
    details.
    + Help us build a better perl ORM: http://dbix-
    class.shadowcatsystems.co.uk/ +
  • Chisel Wright at Jul 14, 2006 at 9:45 am

    On Fri, Jul 14, 2006 at 03:03:59AM +0100, Matt S Trout wrote:
    It's a bug. Shame nobody using a setup like yours can have tested the
    dev releases like we asked.
    Yes, I did (half) apologise for this in my first post. I realise it's
    the fault of people like me.

    I just hadn't had the tuits to slap the dev release on my laptop. It
    kinda sounds like I'm the only Pg/Model::DBIC user out there at the
    moment ... :)


    --
    Chisel Wright
    e: chisel at herlpacker.co.uk
    w: http://www.herlpacker.co.uk/

    This is not an automated signature. I type this in to the bottom of every
    message.
  • Brandon Black at Jul 14, 2006 at 1:56 pm

    On 7/14/06, Chisel Wright wrote:
    I just hadn't had the tuits to slap the dev release on my laptop. It
    kinda sounds like I'm the only Pg/Model::DBIC user out there at the
    moment ... :)
    There was one other guy who popped into #catalyst complaining about a
    messed up Model::CDBI model from the same bug, so you're not
    *completely* alone - you're just in unfavorable company :)
  • Chisel Wright at Jul 14, 2006 at 1:58 pm

    On Fri, Jul 14, 2006 at 08:56:12AM -0500, Brandon Black wrote:
    There was one other guy who popped into #catalyst complaining about a
    messed up Model::CDBI model from the same bug, so you're not
    *completely* alone - you're just in unfavorable company :)
    Oh, I thought you lot were the unfavourable bunch ;-)

    --
    Chisel Wright
    e: chisel at herlpacker.co.uk
    w: http://www.herlpacker.co.uk/

    This is not an automated signature. I type this in to the bottom of every
    message.
  • Nathaniel Nuss at Jul 14, 2006 at 2:03 pm

    On Fri, Jul 14, 2006 at 10:45:55AM +0100, Chisel Wright wrote:
    It kinda sounds like I'm the only Pg/Model::DBIC user out there at
    the moment ... :)
    ++ ;)

    I'm just not getting much of a chance to come up for air right now...

    --
    Nate Nuss
  • Brian Cassidy at Jul 16, 2006 at 2:18 am

    Chisel Wright wrote:
    I just hadn't had the tuits to slap the dev release on my laptop. It
    kinda sounds like I'm the only Pg/Model::DBIC user out there at the
    moment ... :)
    We've checked in a potential fix (+ tests) [1]. Please download it and
    test it :)

    -Brian

    [1] http://dev.catalyst.perl.org/changeset/4701
  • Chisel Wright at Jul 17, 2006 at 9:58 am

    On Sat, Jul 15, 2006 at 11:18:04PM -0300, Brian Cassidy wrote:
    We've checked in a potential fix (+ tests) [1]. Please download it and
    test it :)

    -Brian

    [1] http://dev.catalyst.perl.org/changeset/4701
    I've just tried this on my own smaller test-case, where I no longer get
    the error I posted about.

    I've not yet redeployed Parley on my machine, so I can't (yet) confirm
    that it works there. I can't see any reason why it shouldn't, but I'll
    redeploy and confirm in the next day or so.

    Cheers,

    Chisel
    --
    Chisel Wright
    e: chisel at herlpacker.co.uk
    w: http://www.herlpacker.co.uk/

    This is not an automated signature. I type this in to the bottom of every
    message.
  • Chisel Wright at Jul 18, 2006 at 10:27 am

    On Mon, Jul 17, 2006 at 10:58:49AM +0100, Chisel Wright wrote:
    I've not yet redeployed Parley on my machine, so I can't (yet) confirm
    that it works there. I can't see any reason why it shouldn't, but I'll
    redeploy and confirm in the next day or so.
    OK, Parley redeployed last night. Tested on the train this morning.

    After a find_or_create() glitch (solved by moving up to DBIC dev-release
    again) everything seems to work just as I'd expect it to.


    --
    Chisel Wright
    e: chisel at herlpacker.co.uk
    w: http://www.herlpacker.co.uk/

    This is not an automated signature. I type this in to the bottom of every
    message.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupcatalyst @
categoriescatalyst, perl
postedJul 10, '06 at 1:42p
activeJul 18, '06 at 10:27a
posts17
users7
websitecatalystframework.org
irc#catalyst

People

Translate

site design / logo © 2022 Grokbase