Lee Goddard ha scritto:
From: Marcello Romani [mailto:[EMAIL PROTECTED]
Lee Goddard ha scritto:
Is there a variable somewhere that can tell me when Catalyst's
dev-server is starting up? Because it seems to be calling every
method
I've written, but without parameters, which intentionally causes
errors
when in production, but shouldn't during automated tests.
Thanks in anticipation
Can you be more specific ?
What do you mean by 'calling every method I've written ?'
Sorry: I meant when the server starts, it seems to attempt to call 'new'
for every *.pm in MyApp::Model::* :
Couldn't instantiate component "CTT::Model::SWF"
Thanks
Lee
[undef] | Missing fields: path, filebase, filename |
CTT/Model/File.pm CTT::Model::File::new 107
[undef] | Couldn't instantiate component "CTT::Model::SWF", "Missing
fields: path, filebase, filename at ../lib/CTT/Model/File.pm line 109
CTT::Model::File::new('CTT::Model::SWF', 'CTT',
'HASH(0x902fc10)') called at
/usr/local/share/perl/5.8.4/Catalyst/Component.pm line 76
Catalyst::Component::COMPONENT('CTT::Model::SWF', 'CTT',
'HASH(0x902fc10)') called at /usr/local/share/perl/5.8.4/Catalyst.pm
line 1873
eval {...} called at /usr/local/share/perl/5.8.4/Catalyst.pm
line 1873
Catalyst::setup_component('CTT', 'CTT::Model::SWF') called at
/usr/local/share/perl/5.8.4/Catalyst.pm line 1845
Catalyst::setup_components('CTT') called at
/usr/local/share/perl/5.8.4/Catalyst.pm line 872
Catalyst::setup('CTT') called at ../lib/CTT.pm line 74
require CTT.pm called at
/usr/local/share/perl/5.8.4/Catalyst/Test.pm line 90
Catalyst::Test::import('Catalyst::Test', 'CTT') called at (eval
3) line 2
main::BEGIN() called at ../lib/CTT.pm line 0
eval {...} called at ../lib/CTT.pm line 0
eval 'package main;
use Catalyst::Test @imports;
;' called at /usr/local/share/perl/5.8.4/Test/More.pm line 673
Test::More::use_ok('Catalyst::Test', 'CTT') called at 01app.t
line 9
main::BEGIN() called at ../lib/CTT.pm line 0
eval {...} called at ../lib/CTT.pm line 0" at
/usr/local/share/perl/5.8.4/Catalyst/Test.pm line 90
Compilation failed in require at
/usr/local/share/perl/5.8.4/Catalyst/Test.pm line 90.
| 5.8.4/Catalyst/Test.pm Catalyst::Test::import 90
_______________________________________________
List: [email protected]
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/
I suppose your model modules have something like:
sub new {
...
die unless defined ($options->{path});
etc.
}
I've never written such Model/ modules. So far I've always used Model/
modules to access DBIC schemas (and CDBI before that), so I've never had
to write a new() method for those modules.
Having said that, I think that one possible solution could be to get
those parameters from the application config hash instead of expecting
to have them passed to the constructor.
Or maybe you should put those modules outside the Catalyst application,
and write a Module/ wrapper that instantiates them by calling their
constructors with appropriate arguments.
Just my 2 (euro)cents.
HTH.
--
Marcello Romani
Responsabile IT
Ottotecnica s.r.l.
http://www.ottotecnica.com
_______________________________________________
List: [email protected]
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/