blib/lib/auto/share/dist/Alien-LibreSSL/_alien/patch/gen.pl untested

filter: Statementstmt 0.0% 0 / 28 Branchbran 0.0% 0 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 4 Podpod n/a totaltotal 0.0% 0 / 38 CC 1 SCAR 6.9
CC
1
Cov
0%
BEGIN
2.0
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1 use strict;
2 use warnings;
3 use Data::Dumper qw( Dumper );
4 use Path::Tiny qw( path );
5  
6 my $patch_filename = shift @ARGV;
7 die "need filename" unless defined $patch_filename;
8  
9 my($pl_filename) = $patch_filename =~ /^(.*)\.diff$/;
10 die "unable to determine pl name" unless defined $pl_filename;
11 $pl_filename .= '.pl';
12  
13 my @lines = path($patch_filename)->lines;
14  
15 my $filename;
16 my %p;
17  
18 while(@lines)
19 {
20 my $line = shift @lines;
21 if($line =~ /^diff --git a\/(.*?)\s/)
22 {
23 $filename = $1;
24 shift @lines for (1..3);
25 }
26 else
27 {
28 $p{$filename} .= $line;
29 }
30 }
31  
32 path($pl_filename)->spew(
33 "__DATA__\n my ",
34 Dumper(\%p),
35 );
36