[Catalyst] Constructor's instrumentation

Marcello m.romani at spinsoft.it
Tue Oct 4 16:31:46 CEST 2005


Sebastian Riedel ha scritto:
> 
> Am 04.10.2005 um 15:54 schrieb Antoine HULIN:
> 
>> I'd like to see what's going on in a model's constructor (the class is
>> named Fact::M::Storage). So I added the following statement :
>>
>>  $c->log->info("taratata");
>>
>> The statement is executed but the script fails later on as shown in  the
>> following trace :
>>
>>   gabuzo at meuh:~/Fact$ ./script/fact_server.pl
>>   [Tue Oct  4 15:09:47 2005] [catalyst] [debug] Debug messages enabled
>>   [Tue Oct  4 15:09:47 2005] [catalyst] [debug] Loaded dispatcher  
>> "Catalyst::Dispatcher"
>>   [Tue Oct  4 15:09:47 2005] [catalyst] [debug] Loaded engine  
>> "Catalyst::Engine::HTTP"
>>   [Tue Oct  4 15:09:47 2005] [catalyst] [debug] Found home "/home/ 
>> gabuzo/Devel/Fact"
>>   [Tue Oct  4 15:09:48 2005] [catalyst] [info] taratata
>>   [Tue Oct  4 15:09:48 2005] [catalyst] [debug] Loaded components:
>>   .=------------------------------------------------------------------ 
>> ----------=.
>>    
>> |                                                                      
>>        1 |
>>   |  
>> Fact::C::Reference                                                     
>>        |
>>   |  
>> Fact::C::css                                                           
>>        |
>>   |  
>> Fact::V::TT                                                            
>>        |
>>    
>> '=-------------------------------------------------------------------- 
>> --------='
>>
>>   Can't call method "isa" without a package or object reference at
>>   /usr/share/perl5/Catalyst/Dispatcher.pm line 387.
>>   Compilation failed in require at ./script/fact_server.pl line 13.
>>   BEGIN failed--compilation aborted at ./script/fact_server.pl line  13.
>>
>>
>> Line 387 in Dispatcher is the inheritance test in setup_action() :
>>
>>         # We only setup components that inherit from Catalyst::Base
>>     next unless $comp->isa('Catalyst::Base');
>>
>> I also replaced $c-log->info() with a print statement and got the same
>> behaviour.
>>
>> I don't understand why this logging is so disturbing and I'd like to
>> know what the right way to see what's going on in a constructor is.
> 
> 
> So, you say that it didn't work, but you didn't say what it had done  if 
> it worked!
> I'm not very good at prophesying, but i guess you borked something in  
> the model class's new() method.
> It always has to return a instance of itself!

Probably the line $c->log->info("taratata"); is the last one in the 
constructor ?

> 
> -- 
> sebastian
> 
> 
> _______________________________________________
> Catalyst mailing list
> Catalyst at lists.rawmode.org
> http://lists.rawmode.org/mailman/listinfo/catalyst
> 




More information about the Catalyst mailing list