Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Moose Roles and Override

by lune (Pilgrim)
on Feb 07, 2012 at 12:02 UTC ( [id://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?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (6)
As of 2024-04-23 13:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found