use MooseX::ClassAttribute::Meta::Method::Accessor;
+use namespace::autoclean;
use Moose::Role;
# This is the worst role evar! Really, this should be a subclass,
# because it overrides a lot of behavior. However, as a subclass it
# won't cooperate with _other_ subclasses.
-around 'accessor_metaclass' => sub
-{
+around 'accessor_metaclass' => sub {
return 'MooseX::ClassAttribute::Meta::Method::Accessor';
};
-around '_process_options' => sub
-{
+around '_process_options' => sub {
my $orig = shift;
my $class = shift;
my $name = shift;
return $class->$orig( $name, $options );
};
-around attach_to_class => sub
-{
+around attach_to_class => sub {
my $orig = shift;
my $self = shift;
my $meta = shift;
unless $self->is_lazy();
};
-around 'detach_from_class' => sub
-{
+around 'detach_from_class' => sub {
my $orig = shift;
my $self = shift;
my $meta = shift;
$self->$orig($meta);
};
-sub _initialize
-{
+sub _initialize {
my $self = shift;
my $metaclass = shift;
- if ( $self->has_default() )
- {
+ if ( $self->has_default() ) {
$self->set_value( undef, $self->default() );
}
- elsif ( $self->has_builder() )
- {
+ elsif ( $self->has_builder() ) {
$self->set_value( undef, $self->_call_builder( $metaclass->name() ) );
}
}
-around 'default' => sub
-{
+around 'default' => sub {
my $orig = shift;
my $self = shift;
my $default = $self->$orig();
- if ( $self->is_default_a_coderef() )
- {
+ if ( $self->is_default_a_coderef() ) {
return $default->( $self->associated_class() );
}
return $default;
};
-around '_call_builder' => sub
-{
+around '_call_builder' => sub {
shift;
my $self = shift;
my $class = shift;
. "'" );
};
-around 'set_value' => sub
-{
+around 'set_value' => sub {
shift;
- my $self = shift;
- shift; # ignoring instance or class name
- my $value = shift;
+ my $self = shift;
+ shift; # ignoring instance or class name
+ my $value = shift;
- $self->associated_class()->set_class_attribute_value( $self->name() => $value );
+ $self->associated_class()
+ ->set_class_attribute_value( $self->name() => $value );
};
-around 'get_value' => sub
-{
+around 'get_value' => sub {
shift;
- my $self = shift;
+ my $self = shift;
- return $self->associated_class()->get_class_attribute_value( $self->name() );
+ return $self->associated_class()
+ ->get_class_attribute_value( $self->name() );
};
-around 'has_value' => sub
-{
+around 'has_value' => sub {
shift;
- my $self = shift;
+ my $self = shift;
- return $self->associated_class()->has_class_attribute_value( $self->name() );
+ return $self->associated_class()
+ ->has_class_attribute_value( $self->name() );
};
-around 'clear_value' => sub
-{
+around 'clear_value' => sub {
shift;
- my $self = shift;
+ my $self = shift;
- return $self->associated_class()->clear_class_attribute_value( $self->name() );
+ return $self->associated_class()
+ ->clear_class_attribute_value( $self->name() );
};
-no Moose::Role;
-
1;
__END__