| 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
| |||||||||||
| 28 | 68 | ▶ | delete $template->{copy} unless $opts->{'no_copy'}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 29 | 68 | for (qw(derive import)) { | |||||||||
| 30 | 136 | ▶ | if ($template->get_decl_type == PML_TEMPLATE_DECL) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 31 | 2 | ▶ | delete $template->{$_} unless $opts->{'no_template_'.$_}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 32 | } else { | ||||||||||
| 33 | 134 | ▶ | delete $template->{$_} unless $opts->{'no_'.$_}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 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
| |||||||||||
| 42 | 0 | foreach (values %{$self->{$d}}) { | |||||||||
| 43 | 0 | $_->for_each_decl($sub); | |||||||||
| 44 | } | ||||||||||
| 45 | } | ||||||||||
| 46 | } | ||||||||||
| 47 | } | ||||||||||
| 48 | |||||||||||
| 49 | |||||||||||
| 50 | |||||||||||
| 51 | 9 | 1; | |||||||||
| 52 | __END__ | ||||||||||