[Catalyst] mk_component|compclass|comptest|stuff problems

Christopher H. Laco claco at chrislaco.com
Sun Sep 11 06:38:41 CEST 2005


I've stumble across a catch 22 problem with mk_component that I can't 
seen to fix. I'm sure someone with some better internals knowledge 
probably knows the solution, or at least the cause.

First, these controller helpers make their own comp class, tests, and 
template files:

http://handelframework.com/source/trunk/lib/Catalyst/Helper/Controller/Handel/Cart.pm
http://handelframework.com/source/trunk/lib/Catalyst/Helper/Controller/Handel/Order.pm
http://handelframework.com/source/trunk/lib/Catalyst/Helper/Controller/Handel/Checkout.pm

When I first created them, I also had their mk_compclass subs call 
mk_compoent to create a TT view in case it didn't exist. I did this in 
hopes of saving the user a step, having to create a TT view and add it 
to their end sub. THe end subs in the comps these helpers create are pre 
hooked up to the TT view.

Everything up till this point worked just dandy. Now enter the redone 
(and much cleaner) scaffold helper and the catch22 problem:

http://handelframework.com/source/trunk/lib/Catalyst/Helper/Handel/Scaffold.pm

The mk_stuff sub in Handel::Scaffold calls mk_component on all of the 
other controller/model helpers and has them do their magic.

For the most part, it all works, but the tests for all of the 
controllers (cart, orders, checkout) are never created. Instead, the 
numerous calls to ml_component in the scaffold to the helpers appear to 
be create the TT helper over and over. The culprit appears to this line 
in the cart/order/checkout helpers:

> $helper->mk_component($helper->{'app'}, 'view', 'TT', 'TT');

If I comment out that line, and rerun the scaffold helper, all of the 
cart/order/checkout controller tests are created.

That's the catch 22. I like having those controllers create the TT view 
if it doesn't exist. That's one less step the consumer of those helpers 
has too do. But, it creates hell with mk_comptest apparently.

Anyone have and ideas?

It's not a total loss. The scaffold can still make a call to 
mk_component to create th TT view. At least in terms of the scaffold, a 
make everything solution, the view is made automatically for the user.

It's arguable that anyone creating the controllers or models 
individually is on their own anyways in terms of integrating parts.

Thanks,
-=Chris

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3178 bytes
Desc: S/MIME Cryptographic Signature
Url : http://lists.rawmode.org/pipermail/catalyst/attachments/20050911/0f487098/smime.bin


More information about the Catalyst mailing list