[Catalyst] Modifying Catalyst component load order

Rob Hoelz rhoelz at inoc.com
Fri Jul 16 16:55:39 GMT 2010


Hello Catalyst users and developers,

I'll get straight to the point: I have this idea for providing the
ability to modify the component load order in Catalyst.

So there's this snippet of code here that currently determines
component load order in Catalyst 5.80024:

sub setup_components {
  ### code ###
  my @comps = sort { length $a <=> length $b } $class->locate_components($config);
  ### more code ###
}

My current proposal is just to add this:

sub determine_component_load_order {
  shift;
  return sort { length $a <=> length $b } @_;
}

### later on in setup_components
my @comps = $class->determine_component_load_order($class->locate_components($config));

This way, applications requiring a custom load order can override determine_component_load_order if they which,
and plugins can override it to provide cool features like dependency resolution.

Thoughts?

-Rob

PS. If you're curious, the reason I'm doing is is so I can use a Catalyst::Model::DBIC::Schema in a Template::Provider::DBIC
to load templates for a Catalyst::View::TT.

-- 
Rob Hoelz
Software Engineer I
INOC
608.663.4555 x207
608.663.4558 fax
rhoelz at inoc.com
www.inoc.com

*** DELIVERING UPTIME ***
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
Url : http://lists.scsys.co.uk/pipermail/catalyst/attachments/20100716/e4f143ff/signature.pgp


More information about the Catalyst mailing list