Re: [Catalyst] Catalyst::Plugin::AutoCRUD setup_components

2011-11-03 Thread Jason Galea
On Tue, Nov 1, 2011 at 10:00 PM, Jason Galea li...@eightdegrees.com.auwrote:



 On Tue, Nov 1, 2011 at 9:44 PM, Tomas Doran bobtf...@bobtfish.net wrote:


 On 1 Nov 2011, at 10:48, Jason Galea wrote:

 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..


 Yeah, gotcha.

 I'm not sure offhand why this doesn't work, but I can have a poke into
 how AutoCRUD extends things and see if I can reproduce and/or recommend a
 way for AutoCRUD to do it better..


Hi t0m,

I'll try and do some further testing on this tomorrow but at first glance
it appears I've managed to turn the AutoCRUD plugin into a role which works
with the rest of my app.. (file attached).

cheers,

J


AutoCRUD.pm
Description: Perl program
___
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/


Re: [Catalyst] Catalyst::Plugin::AutoCRUD setup_components

2011-11-01 Thread Tomas Doran


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?

Cheers
t0m



___
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/


Re: [Catalyst] Catalyst::Plugin::AutoCRUD setup_components

2011-11-01 Thread Jason Galea
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/


Re: [Catalyst] Catalyst::Plugin::AutoCRUD setup_components

2011-11-01 Thread Tomas Doran


On 1 Nov 2011, at 10:48, Jason Galea wrote:





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..


Yeah, gotcha.

I'm not sure offhand why this doesn't work, but I can have a poke into  
how AutoCRUD extends things and see if I can reproduce and/or  
recommend a way for AutoCRUD to do it better..


Cheers
t0m



___
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/


Re: [Catalyst] Catalyst::Plugin::AutoCRUD setup_components

2011-11-01 Thread Jason Galea
On Tue, Nov 1, 2011 at 9:44 PM, Tomas Doran bobtf...@bobtfish.net wrote:


 On 1 Nov 2011, at 10:48, Jason Galea wrote:

 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..


 Yeah, gotcha.

 I'm not sure offhand why this doesn't work, but I can have a poke into how
 AutoCRUD extends things and see if I can reproduce and/or recommend a way
 for AutoCRUD to do it better..

 oh, ok, cool, thans again.

I was looking at the AutoCrud code and thinking I should be doing things
differently, ie creating a plugin to do what I'm trying to do.. ie2 have a
base app that I can import controllers and stuff from into other apps so
I'd love to know what you think.

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/


[Catalyst] Catalyst::Plugin::AutoCRUD setup_components

2011-10-31 Thread Jason Galea
Hi all,

I'm trying to use  Catalyst::Plugin::AutoCRUD but when correctly set up no
actions are added to my app.
After much hair pulling I found that my use of after 'setup_components'
in my main Catalyst class was preventing setup_components in AutoCRUD from
being called at all.
After removing after 'setup_components' from my app AutoCRUD is loaded
but breaks the rest of my app.

any suggestions?

(I'm using CatalystX::InjectComponent in the after 'setup_components'
method)

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/