Your answer is clear

Colin's Blog

Nested
Stuck on building Roles with a sugary Class.
User: perlDreamer
Date: 2/26/2010 12:34 pm
Views: 656
Rating: 0    Rate [
|
]

WebGUI is in the process of moving to Moose, and I've spent the last few weeks just learning Moose and writing perl.  It has been a very good time. You can see the work that I've done in the git repo in the WebGUI 8 branch:

http://github.com/plainblack/webgui/tree/WebGUI8

WebGUI::Definition provides two sugar methods, property and define, that replace the old definition subroutine/data structure, and it sets up the meta class for properties.  WebGUI::Definition::Asset builds on WebGUI::Definition with just another meta class and property class.

Here's where the hang up comes.  What used to be AssetAspect is now a Moose Role.  Each Role should have all the same sugar and meta class as a regular Asset, but doing this:

    use Moose::Role;
    use WebGUI::Definition::Asset;

makes for Moose puke:

    WebGUI::Role::Asset::RssFeed already has a metaclass, but it does not inherit WebGUI::Definition::Meta::Asset (Moose::Meta::Role=HASH(0x9781a78)) at /usr/local/share/perl/5.10.0/Moose.pm line 160

Reply
Re: Stuck on building Roles with a sugary Class.
User: hdp
Date: 3/1/2010 5:59 pm
Views: 67
Rating: 0    Rate [
|
]

First you're saying the package is a role (`use Moose::Role`), then you're saying it's a regular class (setting the metaclass to something that extends `Moose::Meta::Class`).  It can't be both.

Reply
NextAdd
blue divider bar

Copyright 2010 perlDreamer Consulting | All Rights Reserved | Site Map | Graphic Design by Plain Black