Dist-Dzpl
view release on metacpan or search on metacpan
lib/Dist/Dzpl/Parser.pm view on Meta::CPAN
my $self = shift;
my $stash = shift;
my $importance = shift;
my $input = shift;
die "Missing input" unless defined $input && length $input;
my @stash;
my $manifest = [];
push @stash, { phase => 'runtime', type => $importance, manifest => $manifest };
for my $line ( split m/\n/, $input ) {
s/^\s*//, s/\s*$// for $line;
next if $line =~ m/^#/ || $line !~ m/\S/;
if (
$line =~ m/\A\@([\w\-]+):\z/ || # @Test:
$line =~ m/\A\[([\w\-]+)\]\z/ # [Test]
) {
push @stash, { phase => lc $1, type => $importance, manifest => ( $manifest = [] ) };
}
else {
my ( $package, $version ) = split m/\s+/, $line, 2;
$package = $line unless defined $package;
$version ||= 0;
push @$manifest, ( $package => $version );
}
}
push @$stash, grep { @{ $_->{manifest} } > 0 } @stash;
}
sub _parse_author {
my $self = shift;
my $zilla = shift;
my $input = shift;
my @author;
if ( ref $input eq 'ARRAY' ) {
@author = @$input;
}
elsif ( $input =~ m/\n/ ) {
for my $line ( split m/\n/, $input ) {
local $_ = $line;
next unless m/\S/;
$line =~ s/^\s*//, s/\s*$//;
push @author, $line;
}
}
else {
@author = ($input);
}
( run in 0.769 second using v1.01-cache-2.11-cpan-71847e10f99 )