Skip to content

Instantly share code, notes, and snippets.

@berekuk
Created June 29, 2011 20:16
Show Gist options
  • Select an option

  • Save berekuk/1054827 to your computer and use it in GitHub Desktop.

Select an option

Save berekuk/1054827 to your computer and use it in GitHub Desktop.
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