script/photobackup.pl untested

filter: Statementstmt 0.0% 0 / 32 Branchbran 0.0% 0 / 10 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 0.0% 0 / 6 Podpod n/a totaltotal 0.0% 0 / 53 CC 1 SCAR 6.9
CC
1
Cov
0%
BEGIN
2.0
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1 #!/usr/local/bin/perl
2  
3 use strict;
4 use warnings;
5  
6 =head1 NAME
7  
8 photobackup.pl - Setup and run PhotoBackup server.
9  
10 =head1 SYNOPSIS
11  
12 photobackup.pl init
13 photobackup.pl run
14 photobackup.pl stop
15 photobackup.pl (-h | --help)
16 photobackup.pl --version
17  
18 # Full docs
19 perldoc Net::PhotoBackup::Server
20  
21 =cut
22  
23 use Getopt::Long;
24 use Net::PhotoBackup::Server;
25 use Pod::Usage;
26 use File::Spec ();
27  
28 Getopt::Long::GetOptions(
29 'help|?' => sub {pod2usage},
30 'version' => sub {
31 print "Net::PhotoBackup::Server $Net::PhotoBackup::Server::VERSION\n";
32 exit;
33 }
34 );
35  
36 pod2usage() unless @ARGV == 1;
37 my $action = shift;
38 pod2usage() unless $action =~ m{ \A (?: init | run | stop ) }xms;
39  
40 my $server = Net::PhotoBackup::Server->new();
41 if ( $action eq 'init' || ! $server->config ) {
42 $server->init();
43 }
44 elsif ( $action eq 'run' ) {
45 $server->stop();
46 $server->run();
47 }
48 elsif ( $action eq 'stop' ) {
49 $server->stop();
50 }
51 exit;
52  
53 __END__