[Catalyst] Catalyst::Plugin::AutoCRUD & setup_components
Jason Galea
lists at eightdegrees.com.au
Tue Nov 1 10:48:48 GMT 2011
On Tue, Nov 1, 2011 at 7:38 PM, Tomas Doran <bobtfish at bobtfish.net> wrote:
>
> On 1 Nov 2011, at 03:24, Jason Galea wrote:
>
>
>> any suggestions?
>>
>
> Can you show us the code that doesn't work when it's in your app?
>
Hi t0m,
thanks, I'll try to keep it relevant. If you don't see anything and you'e
still keen there's more but I think these are the relevant parts..
#-----------------------------------------
package MyApp::Catalyst;
extends 'Catalyst';
with MyOtherApp::Web::Role';
# I added some warn statements to AutoCRUD.pm
# if I take this out the app starts and autocrud actions are listed at
startup and my warns are printed.
# with it in my app runs as it should, but no autocrud actions and my warns
are not printed.
after 'setup_components' =3D> sub {
my $class =3D shift;
$class->inject_components('Model', qw! MyAppModel !);
$class->inject_components('View', qw! TT JSON !);
$class->inject_components('Controller', qw! Account Basket !);
};
#-----------------------------------------
package MyOtherApp::Web::Role;
use Moose::Role;
use namespace::autoclean;
use CatalystX::InjectComponent;
my %component_types =3D (
Model =3D> 1,
View =3D> 1,
Controller =3D> 1,
);
sub inject_components{
my ($class, $type, @components) =3D @_;
return unless $component_types{$type};
foreach(@components){
CatalystX::InjectComponent->inject(
into =3D> $class,
component =3D> "MyOtherApp::Catalyst::${type}::".$_,
as =3D> $_
);
}
}
cheers,
J
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20111101/0d104=
dd0/attachment.htm
More information about the Catalyst
mailing list