Add built local::lib
[catagits/Gitalist.git] / local-lib5 / lib / perl5 / MooseX / Role / Parameterized / Meta / Parameter.pm
diff --git a/local-lib5/lib/perl5/MooseX/Role/Parameterized/Meta/Parameter.pm b/local-lib5/lib/perl5/MooseX/Role/Parameterized/Meta/Parameter.pm
new file mode 100644 (file)
index 0000000..0d27708
--- /dev/null
@@ -0,0 +1,44 @@
+package MooseX::Role::Parameterized::Meta::Parameter;
+use Moose;
+extends 'Moose::Meta::Attribute';
+
+our $VERSION = '0.10';
+
+# This doesn't actually do anything because _process_options does not consult
+# the default value of "is". hrm.
+has '+is' => (
+    default => 'ro',
+);
+
+around _process_options => sub {
+    my $orig = shift;
+    my ($class, $name, $options) = @_;
+
+    $options->{is} ||= 'ro';
+
+    $orig->(@_);
+};
+
+__PACKAGE__->meta->make_immutable(
+    inline_constructor => 1,
+    replace_constructor => 1,
+    constructor_name   => "_new",
+);
+no Moose;
+
+1;
+
+__END__
+
+=head1 NAME
+
+MooseX::Role::Parameterized::Meta::Parameter - metaclass for parameters
+
+=head1 DESCRIPTION
+
+This is the metaclass for parameter objects, a subclass of
+L<Moose::Meta::Attribute>. Its sole purpose is to make the default value
+of the C<is> option C<ro>.
+
+=cut
+