| 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
| |||||||||||||||||||||||||||||
| 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
Condition33%1/3
-t STDIN and -t STDOUT
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
| |||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||
| 28 | 0 | my ( $line, $tio ); | |||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||
| 30 | 0 | ▶ | if ( | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$o{"hide_text"} and do {
require POSIX;
$tio = "POSIX::Termios"->new
}
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
}
| |||||||||||||||||||||||||||||
| 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__ | ||||||||||||||||||||||||||||