Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Initial version

  • Loading branch information...
commit 549d122c12e46ecacaacd489e98d422f1e9c5e0e 0 parents
@nothingmuch authored
Showing with 38 additions and 0 deletions.
  1. +38 −0 lib/Dist/Zilla/Plugin/InjectMeta.pm
38 lib/Dist/Zilla/Plugin/InjectMeta.pm
@@ -0,0 +1,38 @@
+package Dist::Zilla::Plugin::InjectMeta;
+use Moose;
+
+use namespace::autoclean;
+
+has metadata => (
+ isa => "HashRef",
+ is => "ro",
+ required => 1,
+);
+
+with qw(Dist::Zilla::Role::MetaProvider);
+
+sub BUILDARGS {
+ my ( $self, @args ) = @_;
+
+ my $meta = $self->SUPER::BUILDARGS(@args);
+
+ my %args;
+
+ foreach my $attr ( $self->meta->get_all_attributes ) {
+ my $arg = $attr->init_arg or next;
+ $args{$arg} = delete $meta->{$arg} if exists $meta->{$arg};
+ }
+
+ $args{metadata} ||= $meta;
+
+ return \%args;
+}
+
+__PACKAGE__->meta->make_immutable;
+
+__PACKAGE__
+
+__END__
+
+
+# ex: set sw=4 et:
Please sign in to comment.
Something went wrong with that request. Please try again.