Magpie/Role/RunningCommand.pm

filter: Statementstmt 77.2% 17 / 22 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 83.3% 5 / 6 Podpod 100% 1 / 1 totaltotal 69.7% 23 / 33 CC 3 SCAR 16.3
CC
3
Cov
65%
run_command
12.0
BEGIN
1.0
BEGIN
1.0
CRAP 5.1
« Magpie/Action/BSWait.pm ↑ Summary Magpie/App/Command/checkout.pm »
1 #
2 # This file is part of App-Magpie
3 #
4 # This software is copyright (c) 2011 by Jerome Quelin.
5 #
6 # This is free software; you can redistribute it and/or modify it under
7 # the same terms as the Perl 5 programming language system itself.
8 #
9 3 ▶use 5.012;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 package App::Magpie::Role::RunningCommand;
14 # ABSTRACT: sthg that can run an external command
15 3 $App::Magpie::Role::RunningCommand::VERSION = '2.010';
16 3 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
17 3 ▶use MooseX::Has::Sugar;
Subroutine BEGIN: called CC=1 SCAR=0.0
18  
19 3 with 'App::Magpie::Role::Logging';
20  
21  
22 # -- public methods
23  
24  
25 0 ▶sub run_command {
Subroutine run_command: not called CC=3 SCAR=24.8
Pod documented
26 0 my ($self, $cmd) = @_;
27 0 my $logger = $self->logger;
28 0 $self->log_debug( "running: $cmd" );
29  
30 0 ▶ my $stderr = $logger->log_level >= 2 ? "" : "2>/dev/null";
Branch: 1 branch
BranchTrueFalseTotal
$logger->log_level >= 2 ? : 0 0 0
31  
32 # run the command
33 0 ▶ system("$cmd $stderr >&2") == 0
Branch: 1 branch
BranchTrueFalseTotal
system("$cmd $stderr >&2") == 0 or $self->log_fatal("command [$cmd] exited with value " . ($? >> 8)) 0 0 0
34 or $self->log_fatal( "command [$cmd] exited with value " . ($?>>8) );
35 }
36  
37  
38
39 3 1;
40  
41 __END__
« Magpie/Action/BSWait.pm ↑ Summary Magpie/App/Command/checkout.pm »