Created
June 29, 2011 20:16
-
-
Save berekuk/1054827 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use strict; | |
| use warnings; | |
| { | |
| package MyApp::Role; | |
| use Moose::Role; | |
| has 'fun' => ( is => 'ro' ); | |
| } | |
| { | |
| package MyApp::Role2; | |
| use Moose::Role; | |
| use MooseX::Role::AttributeOverride; | |
| has_plus 'fun' => ( default => 'yep', ); | |
| with 'MyApp::Role'; | |
| } | |
| { | |
| package MyApp; | |
| use Moose; | |
| with qw(MyApp::Role2); | |
| } | |
| { | |
| package main; | |
| #use MyApp; | |
| use Test::More tests => 1; # last test to print | |
| my $test = MyApp->new(); | |
| is( $test->fun, 'yep', "Default was set by role" ); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment