createTarball.pl untested

filter: Statementstmt 0.0% 0 / 44 Branchbran 0.0% 0 / 8 Conditioncond 0.0% 0 / 4 MC/DCmcdc n/a Subroutinesub 0.0% 0 / 7 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 64 CC 2 SCAR 11.0
CC
2
Cov
0%
safeSystem
6.0
BEGIN
2.0
BEGIN
2.0
CRAP 3.0
1 #!/usr/bin/perl -w
2 use strict;
3  
4 # This is really just a wrapper around
5 # make all test manifest dist
6 #
7 # But it does a few pre-flight checks too
8  
9 use File::Path;
10 use File::Copy;
11 use Config;
12 my $perlpath = $Config{perlpath};
13  
14 use lib 'lib';
15 use Parallel::Loops;
16  
17 # Check that Changes and $Parallel::Loops::VERSION agree on what the latest
18 # version is
19 open I, 'Changes'
20 or die "Couldn't open Changes";
21 my $version = <I>;
22 close I;
23 chomp $version;
24 $version =~ /^Version (.*) on /
25 or die "Unexpected version line: $version";
26 $version = $1;
27  
28 # Test that this version number is the same as that in the .pm
29 die sprintf ("Version mismatch: Changes: '%s', pm: '%s'",
30 $version, $Parallel::Loops::VERSION)
31 if ($version ne $Parallel::Loops::VERSION);
32  
33 my $tarballFile = "Parallel-Loops-$version.tar.gz";
34 my $tarballDir = "tarball";
35 if (-e $tarballFile) {
36 die "$tarballFile already exists - remove it first"
37 }
38 if (-d $tarballDir) {
39 die "$tarballDir dir already exists - remove it first"
40 }
41 sub safeSystem {
42 system(@_);
43 die sprintf( "system call '%s' failed: %d",
44 join(" ", @_),
45 $?
46 )
47 if $?;
48 }
49 # Make sure we have an updated README
50 safeSystem('pod2text --utf8 lib/Parallel/Loops.pm > README');
51 safeSystem('pod2markdown lib/Parallel/Loops.pm > README.md');
52  
53 # Just want to make sure we die if anything isn't up-to-date
54 safeSystem('git diff --exit-code > /dev/null');
55 safeSystem('git archive HEAD --prefix=tarball/ | tar x');
56 chdir "tarball";
57  
58 safeSystem($perlpath, 'Makefile.PL');
59 safeSystem('make', 'all', 'test','manifest', 'dist');
60 move("$tarballFile", '..');
61 chdir "..";
62 rmtree("tarball");