Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

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

Select an option

Save berekuk/3041446 to your computer and use it in GitHub Desktop.
package R;
use Moose::Role;
has "foo" => (
is => "ro",
required => 1,
default => 5
);
package X;
use Moose;
with "R";
has "+foo" => (
builder => "_build_foo"
);
sub _build_foo { 6 }
#### Setting both default and builder is not allowed. at /usr/lib/perl5/Class/MOP/Attribute.pm line 46.
package R;
use Moose::Role;
has "foo" => (
is => "ro",
required => 1,
builder => "_build_foo",
);
sub _build_foo { 5 }
package X;
use Moose;
with "R";
has "+foo" => (
default => 6
);
#### Setting both default and builder is not allowed. at /usr/lib/perl5/Class/MOP/Attribute.pm line 46.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment