my $self = shift;
my $pkg = caller;
my @args = @_;
- &strict::import;
- &warnings::import;
+ strict->import;
+ warnings->import;
$self->do_import($pkg, \@args);
- goto &{$self->next_import};
+ goto &{$self->next_import} if $self->next_import;
}
sub next_import {
--- /dev/null
+package Reaction::Meta::Role;
+
+use Moose;
+use Reaction::Meta::Attribute;
+
+extends 'Moose::Meta::Role';
+
+with 'Reaction::Role::Meta::Role';
+
+no Moose;
+
+__PACKAGE__->meta->make_immutable;
+
+1;
my ($self, $target, $method) = @_;
$target->meta->add_method(@$method);
};
+override next_import => sub {
+ my ($self) = @_;
+ my $import = super;
+ # ugh
+ return sub {
+ push @_, '-metaclass' => 'Reaction::Meta::Role';
+ goto $import;
+ };
+};
sub do_role_sub {
my ($self, $package, $role, $which, $setup) = @_;
confess "Invalid role declaration, should be: role Role which { ... }"
--- /dev/null
+package Reaction::Role::Meta::Role;
+
+use Moose::Role;
+
+around initialize => sub {
+ my $super = shift;
+ my $class = shift;
+ my $pkg = shift;
+ $super->($class, $pkg, 'applied_attribute_metaclass' => 'Reaction::Meta::Attribute', @_ );
+};
+
+1;
--- /dev/null
+package Reaction::Role::Parameterized;
+
+use MooseX::Role::Parameterized ();
+use Reaction::ClassExporter;
+use Reaction::Class;
+use Moose::Meta::Class;
+
+use namespace::clean -except => [ qw(meta) ];
+
+override exports_for_package => sub {
+ my ($self, $package) = @_;
+ my %exports = $self->SUPER::exports_for_package($package);
+ delete $exports{class};
+ return %exports;
+};
+
+override default_base => sub { () };
+
+override exporter_for_package => sub {
+ my ($self) = @_;
+ my ($import) = Moose::Exporter->build_import_methods(
+ also => ['MooseX::Role::Parameterized'],
+ with_caller => ['role'],
+ );
+ $import;
+};
+
+override next_import => sub { };
+
+sub role (&) {
+ my $caller = shift;
+ my ($code) = @_;
+ &MooseX::Role::Parameterized::role($caller, sub {
+ my ($p, %args) = @_;
+ $args{operating_on} = Moose::Util::MetaRole::apply_metaroles(
+ for => $args{operating_on}->name,
+ role_metaroles => {
+ applied_attribute => ['Reaction::Role::Meta::Attribute'],
+ },
+ ) if Moose->VERSION >= 1.9900;
+ $code->($p, %args);
+ });
+}
+
+__PACKAGE__->meta->make_immutable;
+
+
+1;
+
+=head1 NAME
+
+Reaction::Role
+
+=head1 DESCRIPTION
+
+=head1 SEE ALSO
+
+L<Moose::Role>
+
+=head1 AUTHORS
+
+See L<Reaction::Class> for authors.
+
+=head1 LICENSE
+
+See L<Reaction::Class> for the license.
+
+=cut
package Reaction::UI::ViewPort::Field::Role::Mutable;
-use MooseX::Role::Parameterized;
+use Reaction::Role::Parameterized;
use aliased 'Reaction::InterfaceModel::Action';
use aliased 'Reaction::Meta::InterfaceModel::Action::ParameterAttribute';
package Reaction::UI::ViewPort::Field::Role::Mutable::Simple;
-use MooseX::Role::Parameterized;
+use Reaction::Role::Parameterized;
use aliased 'Reaction::UI::ViewPort::Field::Role::Mutable';