| 1 | 1 | ▶ | use strict; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 2 | 1 | ▶ | use warnings; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 3 | |||||||||||||||||||||
| 4 | package Template::Plugin::Transformator; | ||||||||||||||||||||
| 5 | |||||||||||||||||||||
| 6 | # ABSTRACT: TemplateToolkit plugin for Net::NodeTransformator | ||||||||||||||||||||
| 7 | |||||||||||||||||||||
| 8 | 1 | ▶ | use Net::NodeTransformator; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 9 | 1 | ▶ | use Template::Plugin::Filter; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 10 | 1 | ▶ | use base qw( Template::Plugin::Filter ); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 11 | |||||||||||||||||||||
| 12 | 1 | our $VERSION = '0.001'; # VERSION | |||||||||||||||||||
| 13 | |||||||||||||||||||||
| 14 | 4 | ▶ | sub init { | ||||||||||||||||||
|
Subroutine
init: called CC=5 SCAR=18.5
Pod
undocumented
| |||||||||||||||||||||
| 15 | 4 | my $self = shift; | |||||||||||||||||||
| 16 | |||||||||||||||||||||
| 17 | $self->{config} = | ||||||||||||||||||||
| 18 | 4 | ▶ | $self->{_CONTEXT}->{CONFIG}->{PLUGIN_CONFIG}->{Transformator} || {}; | ||||||||||||||||||
|
Condition50%1/2
$self->{'_CONTEXT'}{'CONFIG'}{'PLUGIN_CONFIG'}{'Transformator'} || {}
MC/DC0%0/1
$self->{'_CONTEXT'}{'CONFIG'}{'PLUGIN_CONFIG'}{'Transformator'} || {}
$self->{'_CONTEXT'}{'CONFIG'}{'PLUGIN_CONFIG'}{'Transformator'}
Truth table50%1/2
A
A= $self->{'_CONTEXT'}{'CONFIG'}{'PLUGIN_CONFIG'}{'Transformator'}
| |||||||||||||||||||||
| 19 | |||||||||||||||||||||
| 20 | 4 | my %config = %{ $self->{_CONFIG} }; | |||||||||||||||||||
| 21 | 4 | my @args = @{ $self->{_ARGS} }; | |||||||||||||||||||
| 22 | |||||||||||||||||||||
| 23 | 4 | ▶ | my $name = $config{name} || 'Transformator'; | ||||||||||||||||||
|
Condition50%1/2
$config{'name'} || 'Transformator'
MC/DC0%0/1
$config{'name'} || 'Transformator'
$config{'name'}
Truth table50%1/2
A
A= $config{'name'}
| |||||||||||||||||||||
| 24 | |||||||||||||||||||||
| 25 | 4 | $self->{_DYNAMIC} = 1; | |||||||||||||||||||
| 26 | |||||||||||||||||||||
| 27 | 4 | $self->install_filter($name); | |||||||||||||||||||
| 28 | |||||||||||||||||||||
| 29 | $self->{nnt} = | ||||||||||||||||||||
| 30 | $self->{config}->{connect} | ||||||||||||||||||||
| 31 | ? Net::NodeTransformator->new( $self->{config}->{connect} ) | ||||||||||||||||||||
| 32 | 4 | ▶ | : Net::NodeTransformator->standalone; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 33 | |||||||||||||||||||||
| 34 | 0 | ▶ | $self->{engine} = $config{engine} || $args[0]; | ||||||||||||||||||
|
Condition0%0/3
$config{'engine'} || $args[0]
MC/DC0%0/2
$config{'engine'} || $args[0]
$config{'engine'}
$args[0]
Truth table0%0/3
A || B
A= $config{'engine'}B= $args[0]
| |||||||||||||||||||||
| 35 | |||||||||||||||||||||
| 36 | 0 | return $self; | |||||||||||||||||||
| 37 | } | ||||||||||||||||||||
| 38 | |||||||||||||||||||||
| 39 | 0 | ▶ | sub filter { | ||||||||||||||||||
|
Subroutine
filter: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||
| 40 | 0 | my ( $self, $text, $args, $conf ) = @_; | |||||||||||||||||||
| 41 | |||||||||||||||||||||
| 42 | 0 | my %config = %$conf; | |||||||||||||||||||
| 43 | |||||||||||||||||||||
| 44 | my $nnt = | ||||||||||||||||||||
| 45 | $config{connect} | ||||||||||||||||||||
| 46 | ? Net::NodeTransformator->new( $config{connect} ) | ||||||||||||||||||||
| 47 | 0 | ▶ | : $self->{nnt}; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 48 | |||||||||||||||||||||
| 49 | 0 | my $engine = $self->{engine}; | |||||||||||||||||||
| 50 | 0 | ▶ | $engine ||= shift @$args; | ||||||||||||||||||
|
Condition0%0/3
$engine ||= shift @$args
MC/DC0%0/2
$engine ||= shift @$args
$engine
shift @$args
Truth table0%0/3
A ||= B
A= $engineB= shift @$args
| |||||||||||||||||||||
| 51 | |||||||||||||||||||||
| 52 | 0 | $text = $nnt->transform( $engine, $text, $conf ); | |||||||||||||||||||
| 53 | } | ||||||||||||||||||||
| 54 | |||||||||||||||||||||
| 55 | 1 | 1; | |||||||||||||||||||
| 56 | |||||||||||||||||||||
| 57 | __END__ | ||||||||||||||||||||