Skip to content

Instantly share code, notes, and snippets.

@ian-kent
Created July 29, 2013 12:44
Show Gist options
  • Save ian-kent/6104066 to your computer and use it in GitHub Desktop.
Save ian-kent/6104066 to your computer and use it in GitHub Desktop.
package MooseRole;
use Moose::Role;
sub dosomething {
my ($field, %args) = @_;
my $package = caller;
use Data::Dumper;
print Dumper $package->meta->get_attribute($field);
}
package MooseClass;
use Moose;
BEGIN {
with 'MooseRole';
}
has 'something' => ( is => 'rw' );
dosomething 'something' => ( a => 1, b => 2 );
__PACKAGE__->meta->make_immutable;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment