[Catalyst] ::Model::SomeTable->some_method() problem
Chisel Wright
chisel at herlpacker.co.uk
Tue Jul 11 11:51:15 CEST 2006
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->default "Can't locate object method "some_method" via package "ClassMethod::Model::CMDB::ClassMethod" at /home/chisel/development/svk/parley/issues/model_method/ClassMethod/script/../lib/ClassMethod/Controller/Root.pm line 32."</code></p></pre></div>
chisel at ferrari ClassMethod $
More information about the Catalyst
mailing list