[catalyst] conditional loading of Controllers and Models
Kee Hinckley
nazgul at somewhere.com
Tue Jul 17 02:14:49 GMT 2007
On Jul 16, 2007, at 8:48 AM, Daniel McBrearty wrote:
> is there a way to have some C's and M's load into catalyst
> conditionally? for example, if some config variable is set?
You can call load_classes() and pass something other than the default
values. At one point for some reason I wanted to load only the
modules at the top of my Schema directory, and not include anything
in subfolders, so I did this:
throws ::Error::Unexpected;
# Only get the first level items, I don't want sub folders.
use Module::Find;
__PACKAGE__->load_classes(map { substr $_, length(__PACKAGE__ .
'::') } findsubmod(__PACKAGE__));
More information about the Catalyst
mailing list