A Moose role to add application "awareness".
$c->path_to("some/file") method that makes everything very convenient.It also doesn't exist outside of Catalyst, and that makes me sad. I started working in a role that incrementally grew and grew and now is fairly full featured. I don't really want to release it to the CPAN, because things like Bread::Board are much better. This is also a really half-baked solution, and I don't want to pollute the elegant world of MooseX:: with my sub-par contributions.
I can, however, blog about them.
It's a rather long read for the full code, but the general idea is that it gets you the familiar MyApp->new_with_config construction, with an configurable configuration file. You get the configuration substitutes (giving you $instance->path_to and MyApp->path_to both, but this is ultra hacky). The usage, with coercion, is pretty simple:
I will probably not release this to CPAN. I've heard some rumblings about a MooseX::Build which is probably a better solution but for now this is my happy cargo-cult version. It has flaws, needs to use MooseX::YAML and several other fixes (look at the get_app_root method, how terrible is that?).
Comments