On Thu, Apr 22, 2010 at 02:54:07PM -0700, Kate Yoak wrote:
> Just a couple of notes that would be of use if they were in the  
> documentation:
> 
> 1. The bad news: Because of the weirdness of role{} block, the child,  
> nor the role cannot be declared within the same file with the script.   
> (Like you might do while trying to test sample functionality!)


Are you sure? e.g. have you tried including each namespace in its own
block?  Otherwise, each package is polluting each other's namespaces.
(Alternatively, you could use namespace::autoclean.)

{
    package MyRole;
    use MooseX::Role::Parameterized;
    role {};
    1;
}

{
    package MyClass;
    use Moose;
    with MyRole => {};
    1;
}

package main;

my $obj = MyClass->new();
print "obj is: " . $obj->dump(1);



-- 
       "Debugging is twice as hard as writing the code in the first place.
       Therefore, if you write the code as cleverly as possible, you are,
       by definition, not smart enough to debug it." - Brian W. Kernighan
            .             .            .            .             .
Karen Etheridge, ka...@etheridge.ca       GCS C+++$ USL+++$ P+++$ w--- M++
http://etheridge.ca/                      PS++ PE-- b++ DI++++ e++ h(-)

Reply via email to