Dist/Zilla/Plugin/ATOOMIC/Role/CoreCounter.pm untested

filter: Statementstmt 0.0% 0 / 29 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 8 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 42 CC 3 SCAR 16.1
CC
3
Cov
0%
_core_count
12.0
BEGIN
2.0
BEGIN
2.0
CRAP 5.0
1 package Dist::Zilla::Plugin::ATOOMIC::Role::CoreCounter;
2  
3 use v5.10;
4  
5 use strict;
6 use warnings;
7 use autodie;
8 use namespace::autoclean;
9  
10 our $VERSION = '1.00';
11  
12 use File::Which qw( which );
13  
14 use Moose::Role;
15  
16 ## no critic (Subroutines::ProhibitUnusedPrivateSubroutines)
17 sub _core_count {
18 my $nproc = which('nproc');
19 return 2 unless $nproc;
20  
21 ## no critic (InputOutput::ProhibitBacktickOperators)
22 my $count = `$nproc`;
23 return 2 unless defined $count;
24  
25 $count =~ s/^\s+|\s+$//g;
26  
27 return $count * 2;
28 }
29  
30 1;
31  
32 # ABSTRACT: Knows how to count cores (on Linux only for now)
33  
34 __END__