blib/lib/Acme/123.pm

filter: Statementstmt 92.3% 24 / 26 Branchbran n/a Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 85.7% 6 / 7 Podpod 0.0% 0 / 4 totaltotal 73.8% 31 / 42 CC 3 SCAR 8.6
CC
3
Cov
86%
printnumbers
6.0
new
2.1
BEGIN
1.0
CRAP 2.4
↑ Summary
1 package Acme::123;
2 2 require Exporter;
3
4 2 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
5 2 ▶ use Exporter ();
Subroutine BEGIN: called CC=1 SCAR=0.0
6 2 ▶ use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
Subroutine BEGIN: called CC=1 SCAR=0.0
7 2 $VERSION = '0.04';
8 2 @ISA = qw(Exporter);
9 2 @EXPORT = qw(printnumbers setLanguage getnumbers);
10 2 @EXPORT_OK = qw();
11 2 %EXPORT_TAGS = qw(@numbers);
12 }
13
14 2 my %languages = (
15 'en' => [qw /one two three four five six seven eight nine ten/],
16 'fr' => [qw /un deux trois quatre cinq six sept huit neuf dix/],
17 'sp' => [qw /uno dos tres cuatro cinco seis siete ocho nueve diez/],
18 'it' => [qw /uno due tre quattro cinque sei sette otto nove dieci/]
19 );
20 2 my @numbers = @{$languages {en}};
21
22 0 ▶sub printnumbers {
Subroutine printnumbers: not called CC=2 SCAR=17.9
Pod undocumented
23 0 foreach (@numbers) {
24 0 print "$_ \n";
25 }
26 }
27
28 1 ▶sub setLanguage {
Subroutine setLanguage: called CC=1 SCAR=0.0
Pod undocumented
29 1 my $self = shift;
30 1 my $language = shift;
31 1 @numbers = @{$languages {$language}};
32 }
33
34 2 ▶sub getnumbers {
Subroutine getnumbers: called CC=1 SCAR=0.0
Pod undocumented
35 2 return @numbers;
36 }
37
38 sub new
39 2 ▶{
Subroutine new: called CC=2 SCAR=7.6
Pod undocumented
40 2 my ($class, %parameters) = @_;
41
42 2 ▶ my $self = bless ({}, ref ($class) || $class);
Condition33%1/3
ref $class || $class
l!l&&r!l&&!r
020
MC/DC0%0/2
ref $class || $class
ref $class $class
Truth table33%1/3
A || B
A= ref $classB= $class
ABresult
1X1
011
000
43
44 2 return $self;
45 }
46
47 =head1 NAME
48
49 Acme::123 - Prints 1-10 in different languages
50
51 =head1 SYNOPSIS
52
53 use Acme::123;
54 my $123 = Acme::123->new;
55
56 $123->printnumbers; #print English numbers
57
58 $123->setLanguage('fr'); #sets language to French
59
60 $123->printnumbers; #prints French numbers
61
62 =head1 DESCRIPTION
63
64 Prints numbers one through ten in different languages. Currently only
65 English, French, Spanish, and Italian supported. In later versions, more languages
66 will be supported.
67
68 =head1 TODO
69
70 Support for many more languages.
71
72 Print one through one hundred in many different langauges.
73
74 =head1 AUTHOR
75
76 Nathan <jprogrammer082@gmail.com>
77
78 =head1 COPYRIGHT
79
80 This program is free software; you can redistribute
81 it and/or modify it under the same terms as Perl itself.
82
83 The full text of the license can be found in the
84 LICENSE file included with this module.
85
86
87 =head1 SEE ALSO
88
89 Lingua::Num2Word
90
91 =cut
92
93 #################### main pod documentation end ###################
94
95
96 2 1;
97 # The preceding line will help the module return a true value
98
↑ Summary