Tiny/readline.pm

filter: Statementstmt 73.9% 17 / 23 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 71.4% 5 / 7 Podpod 50.0% 1 / 2 totaltotal 71.8% 23 / 32 CC 1 SCAR 2.5
CC
1
Cov
74%
readline
2.0
readkey
2.0
BEGIN
1.0
CRAP 1.3
« Tiny.pm ↑ Summary
1 package Term::ReadLine::Tiny::readline;
2 =head1 NAME
3  
4 Term::ReadLine::Tiny::readline - A non-OO package of Term::ReadLine::Tiny
5  
6 =head1 VERSION
7  
8 version 1.08
9  
10 =head1 SYNOPSIS
11  
12 use Term::ReadLine::Tiny::readline;
13
14 while ( defined($_ = readline("Prompt: ")) )
15 {
16 print "$_\n";
17 }
18 print "\n";
19
20 $s = "";
21 while ( defined($_ = readkey(1)) )
22 {
23 $s .= $_;
24 }
25 print "\n$s\n";
26  
27 =cut
28 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
29 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
30 1 ▶use v5.10.1;
Subroutine BEGIN: called CC=1 SCAR=0.0
31 1 ▶use Term::ReadLine::Tiny;
Subroutine BEGIN: called CC=1 SCAR=0.0
32  
33  
34 BEGIN
35 {
36 1 ▶ require Exporter;
Subroutine BEGIN: called CC=1 SCAR=0.0
37 1 our $VERSION = '1.08';
38 1 our @ISA = qw(Exporter);
39 1 our @EXPORT = qw(readline readkey);
40 1 our @EXPORT_OK = qw();
41 }
42  
43  
44 =head1 Functions
45  
46 =cut
47 =head2 readline([$prompt[, $default[, IN[, OUT]]]])
48  
49 interactively gets an input line. Trailing newline is removed.
50  
51 Returns C<undef> on C<EOF>.
52  
53 =cut
54 sub readline
55 {
56 0 ▶ my ($prompt, $default, $IN, $OUT) = @_;
Subroutine readline: not called CC=1 SCAR=6.9
Pod undocumented
57 0 my $term = Term::ReadLine::Tiny->new(undef, $IN, $OUT);
58 0 return $term->readline($prompt, $default);
59 }
60  
61 =head2 readkey([$echo[, IN[, OUT]]])
62  
63 reads a key from input and echoes if I<echo> argument is C<TRUE>.
64  
65 Returns C<undef> on C<EOF>.
66  
67 =cut
68 sub readkey
69 {
70 0 ▶ my ($echo, $IN, $OUT) = @_;
Subroutine readkey: not called CC=1 SCAR=6.9
Pod documented
71 0 my $term = Term::ReadLine::Tiny->new(undef, $IN, $OUT);
72 0 return $term->readkey($echo);
73 }
74  
75  
76 1 1;
77 __END__
« Tiny.pm ↑ Summary