[Catalyst] Refactoring Controllers

Steve steve at matsch.com
Wed Jul 27 13:29:56 GMT 2011


Hi all,

I have a question regarding controller refactoring, and whether 
subclassing (or adding a Moose role) would be a good idea for a 
particular application.

The application creates 6 different types of invoices, each representing 
a particular type of service.  Currently, I have a controller for each 
that handles the various steps that must be taken to produce and 
ultimately send these invoices.  ALL OF THESE CONTROLLERS HAVE THE SAME 
ACTIONS, and most of the same logic, which to me says I should refactor 
these controllers...I just don't know how, and also whether the benefit 
is worth the work.  Almost certainly it would not be worth it in and of 
itself, however I might want to write another application someday where 
knowing this would certainly be useful :)

So IF this seems reasonable, and my controllers are 'FOOcontrol', 
'BARcontrol', 'BAZcontrol', and my actions are 'initialize', 
'upload_data', 'process', 'generate_invoices'...etc., what is a good way 
to stay DRY?  In particular I'm having a hard time wrapping my mind 
around how the URI's would be handled.

Thanks,
Steve



More information about the Catalyst mailing list