Skip to content

Instantly share code, notes, and snippets.

@cfedde
Last active December 24, 2015 03:08
Show Gist options
  • Save cfedde/6734955 to your computer and use it in GitHub Desktop.
Save cfedde/6734955 to your computer and use it in GitHub Desktop.
What is special about the "name" attribute in this moose module?
use Modern::Perl;
package A;
use Moose;
use YAML::XS;
has size => (
is => 'ro',
default => 4,
);
has place => (
is => 'ro',
default => 'main street',
);
has name => (
is => 'ro',
default => 'bob',
);
has alt => (
is => 'ro',
builder => '_build_aux',
);
sub _build_aux {
my $s = shift;
say Dump $s;
return reverse $s->name;
}
package main;
my $x = A->new();
say $x->name;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment