PML/Schema/Template.pm

filter: Statementstmt 83.3% 40 / 48 Branchbran 50.0% 6 / 12 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 83.3% 10 / 12 Podpod 100% 4 / 4 totaltotal 78.9% 60 / 76 CC 11 SCAR 19.6
CC
11
Cov
77%
for_each_decl
20.0
simplify
8.2
get_decl_type_str
2.0
CRAP 7.1
« PML.pm ↑ Summary PML/Instance/Common.pm »
1 package Treex::PML::Schema::Template;
2  
3 9 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 9 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 9 ▶use vars qw($VERSION);
Subroutine BEGIN: called CC=1 SCAR=0.0
7 9 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
8 9 $VERSION='2.29'; # version template
9 }
10 9 ▶no warnings 'uninitialized';
Subroutine BEGIN: called CC=1 SCAR=0.0
11 9 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 9 ▶use Treex::PML::Schema::Constants;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 9 ▶use base qw(Treex::PML::Schema::XMLNode);
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 6 ▶sub get_decl_type { return(PML_TEMPLATE_DECL); }
Subroutine get_decl_type: called CC=1 SCAR=0.0
Pod documented
16 0 ▶sub get_decl_type_str { return('template'); }
Subroutine get_decl_type_str: not called CC=1 SCAR=6.9
Pod documented
17  
18 68 ▶sub simplify {
Subroutine simplify: called CC=8 SCAR=21.1
Pod documented
19 68 my ($template,$opts)=@_;
20 68 for my $c (
21 39 sort {$a->{'-#'} <=> $b->{'-#'}}
22 11 ((map { @{$template->{$_}} } grep {exists $template->{$_} } qw(copy import)),
23 12 (map { values %{$template->{$_}} } grep {exists $template->{$_} } qw(template derive)))) {
24 # print STDERR "Processing <$c->{-xml_name}>\n";
25 36 $c->simplify($opts);
26 }
27 68 ▶ delete $template->{template} unless $opts->{'preserve_templates'};
Branch: 1 branch
BranchTrueFalseTotal
unless $opts->{"preserve_templates"} 68 0 68
28 68 ▶ delete $template->{copy} unless $opts->{'no_copy'};
Branch: 1 branch
BranchTrueFalseTotal
unless $opts->{"no_copy"} 68 0 68
29 68 for (qw(derive import)) {
30 136 ▶ if ($template->get_decl_type == PML_TEMPLATE_DECL) {
Branch: 1 branch
BranchTrueFalseTotal
if ($template->get_decl_type == 22) { } 2 134 136
31 2 ▶ delete $template->{$_} unless $opts->{'no_template_'.$_};
Branch: 1 branch
BranchTrueFalseTotal
unless $$opts{'no_template_' . $_} 2 0 2
32 } else {
33 134 ▶ delete $template->{$_} unless $opts->{'no_'.$_};
Branch: 1 branch
BranchTrueFalseTotal
unless $$opts{'no_' . $_} 134 0 134
34 }
35 }
36 }
37 0 ▶sub for_each_decl {
Subroutine for_each_decl: not called CC=4 SCAR=30.0
Pod documented
38 0 my ($self,$sub)=@_;
39 0 $sub->($self);
40 0 for my $d (qw(template type)) {
41 0 ▶ if (ref $self->{$d}) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $self->{$d}) 0 0 0
42 0 foreach (values %{$self->{$d}}) {
43 0 $_->for_each_decl($sub);
44 }
45 }
46 }
47 }
48  
49  
50  
51 9 1;
52 __END__
« PML.pm ↑ Summary PML/Instance/Common.pm »