Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: Moose Roles and Override

by lune (Pilgrim)
on Feb 07, 2012 at 12:02 UTC ( #952262=note: print w/replies, xml ) Need Help??


in reply to Moose Roles and Override

Explained in Method Conflicts and in the following section "Method Exclusion and aliasing".
package top; use Moose::Role; requires 'token'; sub foo { print "foo\n"; } package bottom; use Moose::Role; with 'top' => { -alias =>{ foo => '_foo', }, -excludes => [ 'foo' ], }; sub foo { print "bar\n"; } package something; use Moose; with "bottom"; sub token { print "I don't want to implement token untill the concerete class +but I want to use bottom's version of foo\n"; } package main; my $something = new something; $something->foo;

Replies are listed 'Best First'.
Re^2: Moose Roles and Override
by edwinorc (Novice) on Feb 08, 2012 at 08:16 UTC

    Thanks for your quick helpful response. It works and solved my problem perfectly. I think It would be cool if override/super could be used.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://952262]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (3)
As of 2022-05-29 03:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (101 votes). Check out past polls.

    Notices?