Rebuild/App.pm untested

filter: Statementstmt 0.0% 0 / 36 Branchbran 0.0% 0 / 8 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 0.0% 0 / 8 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 59 CC 5 SCAR 21.6
CC
5
Cov
0%
run
20.0
_display_version
6.0
BEGIN
2.0
CRAP 8.7
1 use strict;
2 use warnings;
3  
4 package TCP::Rebuild::App;
5  
6 =head1 NAME
7  
8 TCP::Rebuild::App - the guts of the tcprebuild command
9  
10 =head1 SYNOPSIS
11  
12 #!/usr/bin/perl
13 use TCP::Rebuild::App;
14 TCP::Rebuild::App->run;
15  
16 =cut
17  
18 use File::Spec;
19 use Getopt::Long qw(GetOptions);
20 use Pod::Usage;
21  
22 sub _display_version {
23 my $class = shift;
24 no strict 'refs';
25 print "tcprebuild",
26 ($class ne 'TCP::Rebuild' ? ' (from TCP::Rebuild)' : q{}),
27 ", powered by $class ", $class->VERSION, "\n\n";
28 exit;
29 }
30  
31 =head2 run
32  
33 This method is called by F<tcprebuild> to do all the work. Relying on it doing
34 something sensible is plain silly.
35  
36 =cut
37  
38 sub run {
39 my %config;
40 $config{class} = 'TCP::Rebuild';
41 my $version;
42  
43 $config{filter} = '';
44 $config{separator} = 0;
45  
46 GetOptions(
47 "h|help" => sub { pod2usage(1); },
48 "v|version" => sub { $version = 1 },
49 "i|infile=s" => \$config{infile},
50 "f|filter=s" => \$config{filter},
51 # "files-from" => \$config{files-from},
52 "s|separator+" => \$config{separator}
53 ) or pod2usage(2);
54  
55 eval "require $config{class}";
56 die $@ if $@;
57  
58 _display_version($config{class}) if $version;
59 pod2usage(2) unless $config{infile};
60  
61 # Flush output after writes
62 $|++;
63  
64 my $o = $config{class}->new(
65 separator => $config{separator},
66 filter => $config{filter}
67 );
68  
69 $o->rebuild($config{infile});
70 }
71  
72 =head1 SEE ALSO
73  
74 =head1 AUTHORS
75  
76 David Cannings, <F<david at edeca.net>>
77  
78 Copyright 2010, released under the same terms as Perl itself.
79  
80 =cut
81  
82 1;
83