From: Dave Rolsky Date: Sun, 5 Jun 2011 21:25:31 +0000 (-0500) Subject: Add definition context to class attributes X-Git-Tag: v0.25~6 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=aafd9839b19060a3bdf19d20f64bab4c2fdbde3d;p=gitmo%2FMooseX-ClassAttribute.git Add definition context to class attributes --- diff --git a/lib/MooseX/ClassAttribute.pm b/lib/MooseX/ClassAttribute.pm index ca822ba..53a2a7c 100644 --- a/lib/MooseX/ClassAttribute.pm +++ b/lib/MooseX/ClassAttribute.pm @@ -5,6 +5,7 @@ use warnings; use Moose 1.23 (); use Moose::Exporter; +use Moose::Util; use MooseX::ClassAttribute::Trait::Class; use MooseX::ClassAttribute::Trait::Role; use MooseX::ClassAttribute::Trait::Application::ToClass; @@ -27,10 +28,11 @@ Moose::Exporter->setup_import_methods( sub class_has { my $meta = shift; my $name = shift; - my %options = @_; my $attrs = ref $name eq 'ARRAY' ? $name : [$name]; + my %options = ( definition_context => Moose::Util::_caller_info(), @_ ); + $meta->add_class_attribute( $_, %options ) for @{$attrs}; }