Phonology/Segment/Boundary.pm

filter: Statementstmt 80.9% 17 / 21 Branchbran 16.6% 1 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 87.5% 7 / 8 Podpod 80.0% 4 / 5 totaltotal 72.5% 29 / 40 CC 4 SCAR 13.6
CC
4
Cov
67%
value_ref
8.7
all_values
2.0
BEGIN
1.0
CRAP 3.9
« Phonology/Syllable.pm ↑ Summary Phonology/Word.pm »
1 #!/usr/bin/perl
2  
3 package Lingua::Phonology::Segment::Boundary;
4  
5 # This class defines BOUNDARY segments, used by Linuga::Phonology::Rules. A
6 # Boundary segment should always return true from BOUNDARY() or
7 # value('BOUNDARY'), but false from everything else. Only a few tweaks are
8 # needed to make sure that this happens.
9  
10 8 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 8 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 8 ▶use base 'Lingua::Phonology::Segment';
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 8 our $VERSION = 0.2;
15  
16 415 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
Pod documented
17 415 bless {}, shift;
18 }
19  
20 # Be a boundary (duh) - Segment::AUTOLOAD won't do this since there's no
21 # BOUNDARY feature
22 37 ▶sub BOUNDARY {
Subroutine BOUNDARY: called CC=1 SCAR=0.0
Pod undocumented
23 37 return 1;
24 }
25  
26 # Don't ever be anything else
27 34 ▶sub value_ref {
Subroutine value_ref: called CC=4 SCAR=21.7
Pod documented
28 34 my $self = shift;
29 34 ▶ if ($_[0] eq 'BOUNDARY') {
Branch: 1 branch
BranchTrueFalseTotal
if ($_[0] eq "BOUNDARY") 0 34 34
30 0 ▶ return 1 if $self->{WANT} eq 'number';
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"WANT"} eq "number" 0 0 0
31 0 ▶ return '+' if $self->{WANT} eq 'text';
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"WANT"} eq "text" 0 0 0
32 0 return \1;
33 }
34 34 return;
35 }
36  
37 # Ignore calls to spell, but return a defined value
38 2 ▶sub spell {
Subroutine spell: called CC=1 SCAR=0.0
Pod documented
39 2 return '';
40 }
41  
42 # Return the truth from all_values
43 0 ▶sub all_values {
Subroutine all_values: not called CC=1 SCAR=6.9
Pod documented
44 0 return (BOUNDARY => 1);
45 }
46  
47 8 1;
« Phonology/Syllable.pm ↑ Summary Phonology/Word.pm »