From: Graham Knop Date: Mon, 16 May 2016 21:41:58 +0000 (-0400) Subject: sub for modifying metadata X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=a8fd5adc821c24f04347351e97e875f2246ede82;p=p5sagit%2FDistar.git sub for modifying metadata --- diff --git a/lib/Distar.pm b/lib/Distar.pm index 323b181..50943b7 100644 --- a/lib/Distar.pm +++ b/lib/Distar.pm @@ -70,6 +70,21 @@ sub write_manifest_skip { close $skip; } +sub _clone { + map { + if (ref eq 'HASH') { + my $struct = $_; + { map +($_ => _clone($struct->{$_})), keys %$struct }; + } + elsif (ref eq 'ARRAY') { + [ _clone(@$_) ]; + } + else { + $_; + } + } @_; +} + { package Distar::MM; our @ISA = @MM::ISA; @@ -98,6 +113,16 @@ sub write_manifest_skip { }); } + sub metafile_data { + my $self = shift; + my $meta = { Distar::_clone($self->SUPER::metafile_data(@_) }; + + my $spec_ver = ($meta->{'meta-spec'} && $meta->{'meta-spec'}{version} || 1.4; + my $resources = $meta->{resources} ||= {}; + + %$meta; + } + sub flush { my $self = shift; `git ls-files --error-unmatch MANIFEST.SKIP 2>&1`;