Skip to content

Commit

Permalink
Make this module work with roles in Moose 1.9900+
Browse files Browse the repository at this point in the history
  • Loading branch information
autarch authored and mendel committed May 5, 2011
1 parent 25e35e7 commit 185e495
Showing 1 changed file with 11 additions and 15 deletions.
26 changes: 11 additions & 15 deletions lib/DBIx/Class/MooseColumns.pm
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,19 @@ use Moose::Util::MetaRole;

use DBIx::Class::MooseColumns::Meta::Role::Attribute;

Moose::Exporter->setup_import_methods();

sub init_meta {
my ($class, %args) = (shift, @_);

Moose->init_meta(%args);

Moose::Util::MetaRole::apply_metaroles(
for => $args{for_class},
class_metaroles => {
attribute => ['DBIx::Class::MooseColumns::Meta::Role::Attribute'],
},
);

return $args{for_class}->meta;
my %metaroles = (
class_metaroles => {
attribute => ['DBIx::Class::MooseColumns::Meta::Role::Attribute'],
},
);

if ( $Moose::VERSION >= 1.9900 ) {
$metaroles{role_metaroles} = {
applied_attribute => ['DBIx::Class::MooseColumns::Meta::Role::Attribute'],
};
}

Moose::Exporter->setup_import_methods(%metaroles);

=head1 NAME
Expand Down

0 comments on commit 185e495

Please sign in to comment.