Set up the metaclass of parameterized roles
Shawn M Moore [Sun, 9 Nov 2008 02:44:35 +0000 (02:44 +0000)]
lib/MooseX/Role/Parameterized.pm [new file with mode: 0644]
lib/MooseX/Role/Parameterized/Meta/Role.pm [new file with mode: 0644]

diff --git a/lib/MooseX/Role/Parameterized.pm b/lib/MooseX/Role/Parameterized.pm
new file mode 100644 (file)
index 0000000..8c16ba8
--- /dev/null
@@ -0,0 +1,21 @@
+#!/usr/bin/env perl
+package MooseX::Role::Parameterized;
+use strict;
+use warnings;
+use MooseX::Role::Parameterized::Meta::Role;
+
+use Moose::Role ();
+use Moose::Exporter;
+
+Moose::Exporter->setup_import_methods;
+
+sub init_meta {
+    my $self = shift;
+
+    return Moose::Role->init_meta(@_,
+        metaclass => 'MooseX::Role::Parameterized::Meta::Role',
+    );
+}
+
+1;
+
diff --git a/lib/MooseX/Role/Parameterized/Meta/Role.pm b/lib/MooseX/Role/Parameterized/Meta/Role.pm
new file mode 100644 (file)
index 0000000..60c6eb7
--- /dev/null
@@ -0,0 +1,14 @@
+#!/usr/bin/env perl
+package MooseX::Role::Parameterized::Meta::Role;
+use Moose;
+extends 'Moose::Meta::Role';
+
+use MooseX::Role::Parameterized::Parameters;
+
+sub parameter_class { 'MooseX::Role::Parameterized::Parameters' }
+
+__PACKAGE__->meta->make_immutable;
+no Moose;
+
+1;
+