| 1 | package Term::ReadLine::Caroline; | ||||||||||||||||||||||||||||||||||||||||||||||
| 2 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 1 | ▶ | use utf8; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 1 | ▶ | use 5.008_001; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 1 | ▶ | use Term::Encoding qw/term_encoding/; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 1 | our @ISA = qw(Term::ReadLine::Stub); | |||||||||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 1 | ▶ | use Caroline; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 0 | ▶ | sub ReadLine { __PACKAGE__ } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
ReadLine: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 0 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 0 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||||||
| 17 | # Support multi byte characters | ||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 0 | my $encoding = term_encoding(); | |||||||||||||||||||||||||||||||||||||||||||||
| 19 | 0 | binmode *STDIN, ":encoding(${encoding})"; | |||||||||||||||||||||||||||||||||||||||||||||
| 20 | 0 | binmode *STDOUT, ":encoding(${encoding})"; | |||||||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 0 | my $self = bless { | |||||||||||||||||||||||||||||||||||||||||||||
| 23 | caroline => Caroline->new(), | ||||||||||||||||||||||||||||||||||||||||||||||
| 24 | IN => *STDIN, | ||||||||||||||||||||||||||||||||||||||||||||||
| 25 | OUT => *STDOUT, | ||||||||||||||||||||||||||||||||||||||||||||||
| 26 | Attribs => {}, | ||||||||||||||||||||||||||||||||||||||||||||||
| 27 | }, $class; | ||||||||||||||||||||||||||||||||||||||||||||||
| 28 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 0 | ▶ | sub caroline { shift->{caroline} } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
caroline: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 0 | ▶ | sub readline { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
readline: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 0 | my ( $self, $prompt ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 35 | 0 | ▶ | if (my $cb = $self->{Attribs}->{completion_callback}) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 0 | $self->caroline->completion_callback($cb); | |||||||||||||||||||||||||||||||||||||||||||||
| 37 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 0 | my $line = $self->caroline->readline($prompt); | |||||||||||||||||||||||||||||||||||||||||||||
| 39 | 0 | ▶ | $self->caroline->history_add($line) if defined($line) && $line =~ /\S/; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $line and $line =~ /\S/
MC/DC0%0/2
defined $line and $line =~ /\S/
defined $line
$line =~ /\S/
Truth table0%0/3
A and B
A= defined $lineB= $line =~ /\S/
| |||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 0 | return $line; | |||||||||||||||||||||||||||||||||||||||||||||
| 41 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 0 | ▶ | sub WriteHistory { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
WriteHistory: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 0 | my ($self, $filename) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 45 | 0 | $self->caroline->write_history_file($filename); | |||||||||||||||||||||||||||||||||||||||||||||
| 46 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 0 | ▶ | sub StifleHistory { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
StifleHistory: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 0 | my ($self, $limit) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 50 | 0 | $self->caroline->history_max_len($limit); | |||||||||||||||||||||||||||||||||||||||||||||
| 51 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 0 | ▶ | sub addhistory { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
addhistory: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 55 | 0 | for my $entry (@_) { | |||||||||||||||||||||||||||||||||||||||||||||
| 56 | 0 | $self->caroline->history_add($entry); | |||||||||||||||||||||||||||||||||||||||||||||
| 57 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 58 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 0 | ▶ | sub AddHistory { shift->addhistory(@_) } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
AddHistory: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 0 | ▶ | sub GetHistory { shift->{history} } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
GetHistory: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||||||||||||||||||||
| 62 | 0 | ▶ | sub IN { shift->{IN} } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
IN: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 63 | 0 | ▶ | sub OUT { shift->{OUT} } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
OUT: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 0 | ▶ | sub MinLine { undef } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
MinLine: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||||||||||||||||||||
| 69 | 0 | ▶ | sub findConsole { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
findConsole: not called CC=17 SCAR=57.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 70 | 0 | my $console; | |||||||||||||||||||||||||||||||||||||||||||||
| 71 | my $consoleOUT; | ||||||||||||||||||||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||||||||||||||||||||
| 73 | 0 | ▶ | if (-e "/dev/tty" and $^O ne 'MSWin32') { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/3
-e "/dev/tty" and $^O ne "MSWin32"
MC/DC0%0/2
-e "/dev/tty" and $^O ne "MSWin32"
-e "/dev/tty"
$^O ne "MSWin32"
Truth table0%0/3
A and B
A= -e "/dev/tty"B= $^O ne "MSWin32"
| |||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 0 | $console = "/dev/tty"; | |||||||||||||||||||||||||||||||||||||||||||||
| 75 | ▶ | } elsif (-e "con" or $^O eq 'MSWin32') { | |||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
-e "con" or $^O eq "MSWin32"
MC/DC0%0/2
-e "con" or $^O eq "MSWin32"
-e "con"
$^O eq "MSWin32"
Truth table0%0/3
A or B
A= -e "con"B= $^O eq "MSWin32"
| |||||||||||||||||||||||||||||||||||||||||||||||
| 76 | 0 | $console = 'CONIN$'; | |||||||||||||||||||||||||||||||||||||||||||||
| 77 | 0 | $consoleOUT = 'CONOUT$'; | |||||||||||||||||||||||||||||||||||||||||||||
| 78 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||
| 79 | 0 | $console = "sys\$command"; | |||||||||||||||||||||||||||||||||||||||||||||
| 80 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||||||||||||||||||||
| 82 | 0 | ▶ | if (($^O eq 'amigaos') || ($^O eq 'beos') || ($^O eq 'epoc')) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/6
$^O eq "amigaos" or $^O eq "beos" or $^O eq "epoc"
$^O eq "amigaos" or $^O eq "beos"
MC/DC0%0/3
$^O eq "amigaos" or $^O eq "beos" or $^O eq "epoc"
$^O eq "amigaos"
$^O eq "beos"
$^O eq "epoc"
Truth table0%0/4
A or B or C
A= $^O eq "amigaos"B= $^O eq "beos"C= $^O eq "epoc"
| |||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 0 | $console = undef; | |||||||||||||||||||||||||||||||||||||||||||||
| 84 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 85 | elsif ($^O eq 'os2') { | ||||||||||||||||||||||||||||||||||||||||||||||
| 86 | 0 | ▶ | if ($DB::emacs) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 87 | 0 | $console = undef; | |||||||||||||||||||||||||||||||||||||||||||||
| 88 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||
| 89 | 0 | $console = "/dev/con"; | |||||||||||||||||||||||||||||||||||||||||||||
| 90 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 91 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 0 | ▶ | $consoleOUT = $console unless defined $consoleOUT; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 94 | 0 | ▶ | $console = "&STDIN" unless defined $console; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 95 | 0 | ▶ | if ($console eq "/dev/tty" && !open(my $fh, "<", $console)) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$console eq "/dev/tty" and not open(my $fh, "<", $console)
MC/DC0%0/2
$console eq "/dev/tty" and not open(my $fh, "<", $console)
$console eq "/dev/tty"
not open(my $fh, "<", $console)
Truth table0%0/3
A and not(B)
A= $console eq "/dev/tty"B= not open(my $fh, "<", $console)
| |||||||||||||||||||||||||||||||||||||||||||||||
| 96 | 0 | $console = "&STDIN"; | |||||||||||||||||||||||||||||||||||||||||||||
| 97 | 0 | undef($consoleOUT); | |||||||||||||||||||||||||||||||||||||||||||||
| 98 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 99 | 0 | ▶ | if (!defined $consoleOUT) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 100 | 0 | ▶ | $consoleOUT = defined fileno(STDERR) && $^O ne 'MSWin32' ? "&STDERR" : "&STDOUT"; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined fileno STDERR and $^O ne "MSWin32"
MC/DC0%0/2
defined fileno STDERR and $^O ne "MSWin32"
defined fileno STDERR
$^O ne "MSWin32"
Truth table0%0/3
A and B
A= defined fileno STDERRB= $^O ne "MSWin32"
| |||||||||||||||||||||||||||||||||||||||||||||||
| 101 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 102 | 0 | ($console,$consoleOUT); | |||||||||||||||||||||||||||||||||||||||||||||
| 103 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||||||||||||||||||||
| 105 | 1 | our %Features = ( | |||||||||||||||||||||||||||||||||||||||||||||
| 106 | addHistory => 1, | ||||||||||||||||||||||||||||||||||||||||||||||
| 107 | getHistory => 1, | ||||||||||||||||||||||||||||||||||||||||||||||
| 108 | ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||||||||||||||||||||
| 110 | 0 | ▶ | sub Attribs { shift->{Attribs} } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
Attribs: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 0 | ▶ | sub Features { \%Features } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
Features: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 0 | ▶ | sub ornaments { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
ornaments: not called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 115 | # NIY | ||||||||||||||||||||||||||||||||||||||||||||||
| 116 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||||||||||||||||||||
| 118 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||||||||||||||||||||
| 120 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||