Actions as Moose::Role

View: New views
4 Messages — Rating Filter:   Alert me  

Actions as Moose::Role

by Zbigniew Lukasiak :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

I wanted to start preparing for Catamoose and thought about extracting
some Controller code as Moose::Roles - but unfortunately Catalyst
attributes don't compile normally:

Invalid CODE attributes: CaptureArgs(1) : Chained('/') at t/lib/Base.pm line 7

In a simple class:

package Base;
use strict;
use warnings;

#use Moose::Role;

sub basefoo  :CaptureArgs(1) :Chained('/') { }
sub baseendpoint :Args(1) :Chained('basefoo') { }

1;


--
Zbigniew Lukasiak
http://brudnopis.blogspot.com/
http://perlalchemy.blogspot.com/

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

Re: Actions as Moose::Role

by J. Shirley :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Mon, Jun 16, 2008 at 10:16 AM, Zbigniew Lukasiak <zzbbyy@...> wrote:

> Hi,
>
> I wanted to start preparing for Catamoose and thought about extracting
> some Controller code as Moose::Roles - but unfortunately Catalyst
> attributes don't compile normally:
>
> Invalid CODE attributes: CaptureArgs(1) : Chained('/') at t/lib/Base.pm line 7
>
> In a simple class:
>
> package Base;
> use strict;
> use warnings;
>
> #use Moose::Role;
>
> sub basefoo  :CaptureArgs(1) :Chained('/') { }
> sub baseendpoint :Args(1) :Chained('basefoo') { }
>
> 1;
>
>
> --
> Zbigniew Lukasiak
> http://brudnopis.blogspot.com/
> http://perlalchemy.blogspot.com/
>

Is it intentional to omit the "use base 'Catalyst::Controller';"?

I can use Moose::Role with the base class, but I'm fairly ignorant of catamoose.

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

Re: Actions as Moose::Role

by Zbigniew Lukasiak :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Mon, Jun 16, 2008 at 9:52 PM, J. Shirley <jshirley@...> wrote:

> On Mon, Jun 16, 2008 at 10:16 AM, Zbigniew Lukasiak <zzbbyy@...> wrote:
>> Hi,
>>
>> I wanted to start preparing for Catamoose and thought about extracting
>> some Controller code as Moose::Roles - but unfortunately Catalyst
>> attributes don't compile normally:
>>
>> Invalid CODE attributes: CaptureArgs(1) : Chained('/') at t/lib/Base.pm line 7
>>
>> In a simple class:
>>
>> package Base;
>> use strict;
>> use warnings;
>>
>> #use Moose::Role;
>>
>> sub basefoo  :CaptureArgs(1) :Chained('/') { }
>> sub baseendpoint :Args(1) :Chained('basefoo') { }
>>
>> 1;
>>
>>
>> --
>> Zbigniew Lukasiak
>> http://brudnopis.blogspot.com/
>> http://perlalchemy.blogspot.com/
>>
>
> Is it intentional to omit the "use base 'Catalyst::Controller';"?

Well - I was not sure about that - but with "use base
'Catalyst::Controller';" I get:

Could not load class (Base) because : Can't locate object method
"linearized_isa" via package "Moose::Meta::Role" at
/home/zby/progs/Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/ClassData.pm
line 23.


--
Zbigniew Lukasiak
http://brudnopis.blogspot.com/
http://perlalchemy.blogspot.com/

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

Re: Actions as Moose::Role

by Guillermo Roditi :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Well - I was not sure about that - but with "use base
'Catalyst::Controller';" I get:

Could not load class (Base) because : Can't locate object method
"linearized_isa" via package "Moose::Meta::Role" at
/home/zby/progs/Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/ClassData.pm
line 23.

Roles can't have base classes kids!

The attributes problem is  a known issue and it kills me as well and I promise you I am trying to fix it. Just give me some time and hopefully by the time we are merged back to 5.8 trunk then I'll have come up wit a work-around or a fix. It all stems from the compile vs run time thing (moose = run time). Ideas welcome


--
Guillermo Roditi (groditi)
_______________________________________________
List: Catalyst@...
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@.../
Dev site: http://dev.catalyst.perl.org/
LightInTheBox - Buy quality products at wholesale price