Ask/STDIO.pm

filter: Statementstmt 44.1% 19 / 43 Branchbran 12.5% 1 / 8 Conditioncond 16.6% 1 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 54.5% 6 / 11 Podpod 0.0% 0 / 6 totaltotal 34.6% 27 / 78 CC 7 SCAR 19.1
CC
7
Cov
37%
entry
20.0
is_usable
6.0
quality
4.1
CRAP 6.8
« Ask/Zenity.pm ↑ Summary Ask/Fallback.pm »
1 3 ▶use 5.008008;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 package Ask::STDIO;
6  
7 3 our $AUTHORITY = 'cpan:TOBYINK';
8 3 our $VERSION = '0.015';
9  
10 3 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 3 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 3 with 'Ask::API';
14  
15 0 ▶sub is_usable {
Subroutine is_usable: not called CC=2 SCAR=17.9
Pod undocumented
16 0 my ( $self ) = @_;
17 0 ▶ -t STDIN and -t STDOUT;
Branch: 1 branch
BranchTrueFalseTotal
-t STDIN and -t STDOUT 0 0 0
18 }
19  
20 9 ▶sub quality {
Subroutine quality: called CC=3 SCAR=14.2
Pod undocumented
21 9 ▶ ( -t STDIN and -t STDOUT ) ? 80 : 20;
Branch: 1 branch
BranchTrueFalseTotal
-t STDIN && -t STDOUT ? : 0 9 9
Condition33%1/3
-t STDIN and -t STDOUT
!ll&&!rl&&r
900
MC/DC0%0/2
-t STDIN and -t STDOUT
-t STDIN -t STDOUT
Truth table33%1/3
A and B
A= -t STDINB= -t STDOUT
ABresult
0X0
100
111
22 }
23  
24 0 ▶sub entry {
Subroutine entry: not called CC=4 SCAR=30.0
Pod undocumented
25 0 my ( $self, %o ) = @_;
26 0 ▶ $self->info( text => $o{text} ) if exists $o{text};
Branch: 1 branch
BranchTrueFalseTotal
if exists $o{"text"} 0 0 0
27
28 0 my ( $line, $tio );
29
30 0 ▶ if (
Branch: 1 branch
BranchTrueFalseTotal
if ($o{'hide_text'} and do { require POSIX; $tio = 'POSIX::Termios'->new }) { } 0 0 0
Condition0%0/3
$o{"hide_text"} and do { require POSIX; $tio = "POSIX::Termios"->new }
!ll&&!rl&&r
000
MC/DC0%0/2
$o{"hide_text"} and do { require POSIX; $tio = "POSIX::Termios"->new }
$o{"hide_text"} do { require POSIX; $tio = "POSIX::Termios"->new }
Truth table0%0/3
A and B
A= $o{"hide_text"}B= do { require POSIX; $tio = "POSIX::Termios"->new }
ABresult
0X0
100
111
31 $o{hide_text}
32 0 and do { require POSIX; $tio = 'POSIX::Termios'->new }
33 )
34 {
35 0 require POSIX;
36 0 my $tio = POSIX::Termios->new;
37 0 $tio->getattr( 0 );
38 0 $tio->setlflag( $tio->getlflag & ~POSIX::ECHO() );
39 0 $tio->setattr( 0 );
40 0 chomp( $line = <STDIN> );
41 0 $tio->setlflag( $tio->getlflag | POSIX::ECHO() );
42 0 $tio->setattr( 0 );
43 } #/ if ( $o{hide_text} and...)
44 else {
45 0 chomp( $line = <STDIN> );
46 }
47
48 0 return $line;
49 } #/ sub entry
50  
51 0 ▶sub info {
Subroutine info: not called CC=1 SCAR=6.9
Pod undocumented
52 0 my ( $self, %o ) = @_;
53 0 print STDOUT "$o{text}\n";
54 }
55  
56 0 ▶sub warning {
Subroutine warning: not called CC=1 SCAR=6.9
Pod undocumented
57 0 my ( $self, %o ) = @_;
58 0 print STDERR "WARNING: $o{text}\n";
59 }
60  
61 0 ▶sub error {
Subroutine error: not called CC=1 SCAR=6.9
Pod undocumented
62 0 my ( $self, %o ) = @_;
63 0 print STDERR "ERROR: $o{text}\n";
64 }
65  
66 3 1;
67  
68 __END__
« Ask/Zenity.pm ↑ Summary Ask/Fallback.pm »