Omni/Restore/Filesystem/Single.pm

filter: Statementstmt 34.6% 9 / 26 Branchbran 0.0% 0 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 50.0% 2 / 4 Podpod 100% 1 / 1 totaltotal 32.4% 12 / 37 CC 5 SCAR 29.6
CC
5
Cov
28%
submit
30.0
__ANON__
2.0
BEGIN
1.0
CRAP 19.2
« Omni/Session/Results.pm ↑ Summary Omni/Utils.pm »
1 package Backup::Omni::Restore::Filesystem::Single;
2  
3 1 our $VERSION = '0.01';
4  
5 1 ▶use Params::Validate ':all';
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 use Backup::Omni::Class
8 1 ▶ version => $VERSION,
Subroutine BEGIN: called CC=1 SCAR=0.0
9 base => 'Backup::Omni::Base',
10 utils => 'trim',
11 constants => 'OMNIR',
12 constant => {
13 COMMAND => '%s -filesystem %s:%s "%s" -session %s -tree %s -full -as %s -target %s -no_monitor',
14 },
15 vars => {
16 PARAMS => {
17 -host => 1,
18 -session => 1,
19 -target => 1,
20 -from => 1,
21 -to => 1,
22 -label => { optional => 1, default => '/archive' },
23 -path => { optional => 1, default => '/archive' },
24 }
25 }
26 1 ;
27  
28 Params::Validate::validation_options(
29 0 ▶ on_fail => sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
30 0 my $params = shift;
31 0 my $class = __PACKAGE__;
32 0 Backup::Omni::Base::validation_exception($params, $class);
33 }
34 1 );
35  
36 # ----------------------------------------------------------------------
37 # Public Methods
38 # ----------------------------------------------------------------------
39  
40 0 ▶sub submit {
Subroutine submit: not called CC=5 SCAR=34.0
Pod documented
41 0 my $self = shift;
42  
43 0 my $session = '';
44 0 my $command = sprintf(COMMAND, OMNIR, $self->host, $self->path, $self->label, $self->session, $self->from, $self->to, $self->target);
45 0 my @results = `$command`;
46 0 my $rc = $?;
47  
48 0 ▶ unless (grep(/Restore successfully/, @results)) {
Branch: 1 branch
BranchTrueFalseTotal
unless (grep /Restore successfully/, @results) 0 0 0
49  
50 0 $self->throw_msg(
51 'backup.omni.restore.filesystem.single.submit',
52 'nosubmit',
53 $self->session
54 );
55  
56 }
57  
58 0 foreach my $line (@results) {
59  
60 0 chomp($line);
61 0 ▶ next if ($line eq '');
Branch: 1 branch
BranchTrueFalseTotal
if $line eq "" 0 0 0
62  
63 0 ▶ if ($line =~ /(R-.*)/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($line =~ /(R-.*)/) 0 0 0
64  
65 0 $session = $1;
66 0 last;
67  
68 }
69  
70 }
71  
72 0 return trim($session);
73  
74 }
75  
76 # ----------------------------------------------------------------------
77 # Private Methods
78 # ----------------------------------------------------------------------
79  
80 1 1;
81  
82 __END__
« Omni/Session/Results.pm ↑ Summary Omni/Utils.pm »