On Tue, Nov 1, 2011 at 7:38 PM, Tomas Doran <bobtf...@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' => sub {
  my $class = 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 = (
  Model => 1,
  View => 1,
  Controller => 1,
);

sub inject_components{
  my ($class, $type, @components) = @_;
  return unless $component_types{$type};

  foreach(@components){
    CatalystX::InjectComponent->inject(
      into => $class,
      component => "MyOtherApp::Catalyst::${type}::".$_,
      as => $_
    );
  }

}

cheers,

J
_______________________________________________
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/

Reply via email to