Skip to content

Instantly share code, notes, and snippets.

@melo
Created December 23, 2010 16:35
Show Gist options
  • Select an option

  • Save melo/753218 to your computer and use it in GitHub Desktop.

Select an option

Save melo/753218 to your computer and use it in GitHub Desktop.
How to use Moose attribute traits
##################
# Error management
has 'errors' => (
traits => ['Hash'],
is => 'bare',
isa => 'HashRef',
default => sub { {} },
handles => {
add_error => 'set',
error_for => 'get',
has_errors => 'count',
errors => 'kv',
clear_errors => 'clear',
},
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment