lib/InfluxDB/Writer/AuthHeaderRole.pm

filter: Statementstmt 68.1% 15 / 22 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 60.0% 3 / 5 Podpod n/a totaltotal 50.0% 18 / 36 CC 4 SCAR 17.6
CC
4
Cov
52%
_build__auth_header
12.0
__ANON__
3.7
BEGIN
1.0
CRAP 5.8
« lib/InfluxDB/Writer/FileTailer.pm ↑ Summary script/influx_compact_unwatched.pl »
1 package InfluxDB::Writer::AuthHeaderRole;
2  
3 # ABSTRACT: Helper role
4 4 our $VERSION = '1.003'; # VERSION
5  
6 4 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 4 ▶use MIME::Base64 qw/encode_base64/;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 4 ▶use Log::Any qw($log);
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 4 has 'influx_username' => ( is => 'ro', isa => 'Str', required => 0 );
11 4 has 'influx_password' => ( is => 'ro', isa => 'Str', required => 0 );
12  
13 0 ▶has '_with_auth' => ( is => 'rw', isa => 'Bool', lazy => 1, default => sub { return shift->_auth_header ? 1 : 0 } );
Subroutine __ANON__: not called CC=2 SCAR=13.0
Branch: 1 branch
BranchTrueFalseTotal
(shift())->_auth_header ? : 0 0 0
14 4 has '_auth_header' => ( is => 'ro', isa => 'Str', lazy_build => 1, builder => '_build__auth_header', required => 1 );
15  
16 0 ▶sub _build__auth_header {
Subroutine _build__auth_header: not called CC=3 SCAR=24.8
17 0 my $self = shift;
18  
19 0 ▶ if ( $self->influx_username && $self->influx_password ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->influx_username and $self->influx_password) { } 0 0 0
Condition0%0/3
$self->influx_username and $self->influx_password
!ll&&!rl&&r
000
MC/DC0%0/2
$self->influx_username and $self->influx_password
$self->influx_username $self->influx_password
Truth table0%0/3
A and B
A= $self->influx_usernameB= $self->influx_password
ABresult
0X0
100
111
20 0 my $base64 = encode_base64(
21 join( ":", $self->influx_username, $self->influx_password ) );
22 0 chomp($base64);
23  
24 0 return "Basic $base64";
25 } else {
26 0 return "";
27 }
28 }
29  
30 4 1;
31  
32 __END__
« lib/InfluxDB/Writer/FileTailer.pm ↑ Summary script/influx_compact_unwatched.pl »