| 1 | #----------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 2 | # OWL::Generators::GenOWL | ||||||||||||||||||||||||||||
| 3 | # Author: Edward Kawas <edward.kawas@gmail.com> | ||||||||||||||||||||||||||||
| 4 | # | ||||||||||||||||||||||||||||
| 5 | # For copyright and disclaimer see below. | ||||||||||||||||||||||||||||
| 6 | # | ||||||||||||||||||||||||||||
| 7 | # $Id: GenOWL.pm,v 1.15 2010-01-07 21:51:51 ubuntu Exp $ | ||||||||||||||||||||||||||||
| 8 | #----------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 9 | package OWL::Generators::GenOWL; | ||||||||||||||||||||||||||||
| 10 | 2 | ▶ | use OWL::Utils; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 11 | 2 | ▶ | use OWL::Data::Def::ObjectProperty; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 12 | 2 | ▶ | use OWL::Base; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 13 | 2 | ▶ | use base qw( OWL::Base ); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 14 | 2 | ▶ | use FindBin qw( $Bin ); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 15 | 2 | ▶ | use lib $Bin; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 16 | 2 | ▶ | use Template; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 17 | 2 | ▶ | use File::Spec; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 18 | 2 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | # add versioning to this module | ||||||||||||||||||||||||||||
| 21 | 2 | ▶ | use vars qw /$VERSION/; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 22 | 2 | $VERSION = sprintf "%d.%02d", q$Revision: 1.15 $ =~ /: (\d+)\.(\d+)/; | |||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||
| 24 | #----------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 25 | # A list of allowed attribute names. See OWL::Base for details. | ||||||||||||||||||||||||||||
| 26 | #----------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 27 | { | ||||||||||||||||||||||||||||
| 28 | 2 | my %_allowed = ( outdir => undef ); | |||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||
| 30 | 2 | ▶ | sub _accessible { | ||||||||||||||||||||||||||
|
Subroutine
_accessible: called CC=2 SCAR=7.2
| |||||||||||||||||||||||||||||
| 31 | 2 | my ( $self, $attr ) = @_; | |||||||||||||||||||||||||||
| 32 | 2 | ▶ | exists $_allowed{$attr} or $self->SUPER::_accessible($attr); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 33 | } | ||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||
| 35 | 8 | ▶ | sub _attr_prop { | ||||||||||||||||||||||||||
|
Subroutine
_attr_prop: called CC=3 SCAR=12.5
| |||||||||||||||||||||||||||||
| 36 | 8 | my ( $self, $attr_name, $prop_name ) = @_; | |||||||||||||||||||||||||||
| 37 | 8 | my $attr = $_allowed{$attr_name}; | |||||||||||||||||||||||||||
| 38 | 8 | ▶ | return ref($attr) ? $attr->{$prop_name} : $attr if $attr; | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 39 | 8 | return $self->SUPER::_attr_prop( $attr_name, $prop_name ); | |||||||||||||||||||||||||||
| 40 | } | ||||||||||||||||||||||||||||
| 41 | } | ||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||
| 43 | #----------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 44 | # init | ||||||||||||||||||||||||||||
| 45 | #----------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 46 | 2 | ▶ | sub init { | ||||||||||||||||||||||||||
|
Subroutine
init: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||||||||||||||||||||
| 47 | 36 | my ($self) = shift; | |||||||||||||||||||||||||||
| 48 | 36 | $self->SUPER::init(); | |||||||||||||||||||||||||||
| 49 | 36 | ▶ | $self->outdir( $OWLCFG::GENERATORS_OUTDIR | ||||||||||||||||||||||||||
|
Condition66%2/3
$OWLCFG::GENERATORS_OUTDIR || 'OWL::Utils'->find_file($OWL::Generators::GenOWL::Bin, 'generated')
MC/DC0%0/2
$OWLCFG::GENERATORS_OUTDIR || 'OWL::Utils'->find_file($OWL::Generators::GenOWL::Bin, 'generated')
$OWLCFG::GENERATORS_OUTDIR
'OWL::Utils'->find_file($OWL::Generators::GenOWL::Bin, 'generated')
Truth table66%2/3
A || B
A= $OWLCFG::GENERATORS_OUTDIRB= 'OWL::Utils'->find_file($OWL::Generators::GenOWL::Bin, 'generated')
| |||||||||||||||||||||||||||||
| 50 | || OWL::Utils->find_file( $Bin, 'generated' ) ); | ||||||||||||||||||||||||||||
| 51 | } | ||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||
| 53 | #----------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 54 | # generate_object_property | ||||||||||||||||||||||||||||
| 55 | #----------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 56 | 6 | ▶ | sub generate_object_property { | ||||||||||||||||||||||||||
|
Subroutine
generate_object_property: called CC=7 SCAR=21.8
Pod
documented
| |||||||||||||||||||||||||||||
| 57 | 6 | my ( $self, @args ) = @_; | |||||||||||||||||||||||||||
| 58 | 6 | ▶ | my %args = ( # some default values | ||||||||||||||||||||||||||
|
Condition66%2/3
$OWLCFG::GENERATORS_OUTDIR || 'OWL::Utils'->find_file($OWL::Generators::GenOWL::Bin, 'generated')
MC/DC0%0/2
$OWLCFG::GENERATORS_OUTDIR || 'OWL::Utils'->find_file($OWL::Generators::GenOWL::Bin, 'generated')
$OWLCFG::GENERATORS_OUTDIR
'OWL::Utils'->find_file($OWL::Generators::GenOWL::Bin, 'generated')
Truth table66%2/3
A || B
A= $OWLCFG::GENERATORS_OUTDIRB= 'OWL::Utils'->find_file($OWL::Generators::GenOWL::Bin, 'generated')
| |||||||||||||||||||||||||||||
| 59 | impl_outdir => ( | ||||||||||||||||||||||||||||
| 60 | $OWLCFG::GENERATORS_OUTDIR || OWL::Utils->find_file( $Bin, 'generated' ) | ||||||||||||||||||||||||||||
| 61 | ), | ||||||||||||||||||||||||||||
| 62 | impl_prefix => 'OWL::Data::Property', | ||||||||||||||||||||||||||||
| 63 | force_over => 0, | ||||||||||||||||||||||||||||
| 64 | static_impl => 0, | ||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||
| 66 | # other args, with no default values | ||||||||||||||||||||||||||||
| 67 | # outcode => ref SCALAR | ||||||||||||||||||||||||||||
| 68 | # and the real parameters | ||||||||||||||||||||||||||||
| 69 | @args | ||||||||||||||||||||||||||||
| 70 | ); | ||||||||||||||||||||||||||||
| 71 | 6 | my $property = $args{property}; | |||||||||||||||||||||||||||
| 72 | 6 | $self->_check_outcode(%args); | |||||||||||||||||||||||||||
| 73 | 6 | my $outdir = File::Spec->rel2abs( $args{impl_outdir} ); | |||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||
| 75 | # generate from template | ||||||||||||||||||||||||||||
| 76 | 6 | my $tt = Template->new( ABSOLUTE => 1 ); | |||||||||||||||||||||||||||
| 77 | 6 | my $input = OWL::Utils->find_file( $Bin, 'OWL', 'Generators', 'templates', | |||||||||||||||||||||||||||
| 78 | 'owl-object-property.tt' ); | ||||||||||||||||||||||||||||
| 79 | 6 | my $name = $property->name(); | |||||||||||||||||||||||||||
| 80 | 6 | $LOG->debug("\tGenerating object property for $name\n"); | |||||||||||||||||||||||||||
| 81 | 6 | my $module_name = $property->module_name(); | |||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||
| 83 | # create implementation specific object | ||||||||||||||||||||||||||||
| 84 | 6 | my $impl = { package => $module_name, }; | |||||||||||||||||||||||||||
| 85 | 6 | ▶ | if ( $args{outcode} ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 86 | $tt->process( | ||||||||||||||||||||||||||||
| 87 | $input, | ||||||||||||||||||||||||||||
| 88 | { | ||||||||||||||||||||||||||||
| 89 | obj => $property, | ||||||||||||||||||||||||||||
| 90 | }, | ||||||||||||||||||||||||||||
| 91 | $args{outcode} | ||||||||||||||||||||||||||||
| 92 | 0 | ▶ | ) || $LOG->logdie( $tt->error() ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 93 | } else { | ||||||||||||||||||||||||||||
| 94 | my $outfile = | ||||||||||||||||||||||||||||
| 95 | 6 | File::Spec->catfile( $outdir, split( /::/, $impl->{package} ) ) . '.pm'; | |||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||
| 97 | # do not overwrite an existing file (there may be already | ||||||||||||||||||||||||||||
| 98 | # a real implementation code) | ||||||||||||||||||||||||||||
| 99 | 6 | ▶ | if ( -f $outfile and !$args{force_over} ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
-f $outfile and not $args{"force_over"}
MC/DC0%0/2
-f $outfile and not $args{"force_over"}
-f $outfile
not $args{"force_over"}
Truth table33%1/3
A and not(B)
A= -f $outfileB= not $args{"force_over"}
| |||||||||||||||||||||||||||||
| 100 | 0 | $LOG->logwarn( "Implementation '$outfile' already exists. " | |||||||||||||||||||||||||||
| 101 | . "It will *not* be re-generated. Safety reasons.\n" ); | ||||||||||||||||||||||||||||
| 102 | 0 | return; | |||||||||||||||||||||||||||
| 103 | } | ||||||||||||||||||||||||||||
| 104 | $tt->process( | ||||||||||||||||||||||||||||
| 105 | 6 | ▶ | $input, | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 106 | { | ||||||||||||||||||||||||||||
| 107 | obj => $property, | ||||||||||||||||||||||||||||
| 108 | }, | ||||||||||||||||||||||||||||
| 109 | $outfile | ||||||||||||||||||||||||||||
| 110 | ) || $LOG->logdie( $tt->error() ); | ||||||||||||||||||||||||||||
| 111 | 6 | $LOG->debug("Created $outfile\n"); | |||||||||||||||||||||||||||
| 112 | } | ||||||||||||||||||||||||||||
| 113 | } | ||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||
| 115 | #----------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 116 | # generate_class | ||||||||||||||||||||||||||||
| 117 | #----------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 118 | 20 | ▶ | sub generate_class { | ||||||||||||||||||||||||||
|
Subroutine
generate_class: called CC=7 SCAR=21.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 119 | 20 | my ( $self, @args ) = @_; | |||||||||||||||||||||||||||
| 120 | 20 | ▶ | my %args = ( # some default values | ||||||||||||||||||||||||||
|
Condition66%2/3
$OWLCFG::GENERATORS_OUTDIR || 'OWL::Utils'->find_file($OWL::Generators::GenOWL::Bin, 'generated')
MC/DC0%0/2
$OWLCFG::GENERATORS_OUTDIR || 'OWL::Utils'->find_file($OWL::Generators::GenOWL::Bin, 'generated')
$OWLCFG::GENERATORS_OUTDIR
'OWL::Utils'->find_file($OWL::Generators::GenOWL::Bin, 'generated')
Truth table66%2/3
A || B
A= $OWLCFG::GENERATORS_OUTDIRB= 'OWL::Utils'->find_file($OWL::Generators::GenOWL::Bin, 'generated')
| |||||||||||||||||||||||||||||
| 121 | impl_outdir => ( | ||||||||||||||||||||||||||||
| 122 | $OWLCFG::GENERATORS_OUTDIR || OWL::Utils->find_file( $Bin, 'generated' ) | ||||||||||||||||||||||||||||
| 123 | ), | ||||||||||||||||||||||||||||
| 124 | force_over => 0, | ||||||||||||||||||||||||||||
| 125 | static_impl => 0, | ||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||
| 127 | # other args, with no default values | ||||||||||||||||||||||||||||
| 128 | # outcode => ref SCALAR | ||||||||||||||||||||||||||||
| 129 | # and the real parameters | ||||||||||||||||||||||||||||
| 130 | @args | ||||||||||||||||||||||||||||
| 131 | ); | ||||||||||||||||||||||||||||
| 132 | 20 | my $property = $args{class}; | |||||||||||||||||||||||||||
| 133 | 20 | $self->_check_outcode(%args); | |||||||||||||||||||||||||||
| 134 | 20 | my $outdir = File::Spec->rel2abs( $args{impl_outdir} ); | |||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||
| 136 | # generate from template | ||||||||||||||||||||||||||||
| 137 | 20 | my $tt = Template->new( ABSOLUTE => 1 ); | |||||||||||||||||||||||||||
| 138 | 20 | my $input = OWL::Utils->find_file( $Bin, 'OWL', 'Generators', 'templates', | |||||||||||||||||||||||||||
| 139 | 'owl-class.tt' ); | ||||||||||||||||||||||||||||
| 140 | 20 | my $name = $property->name(); | |||||||||||||||||||||||||||
| 141 | 20 | $LOG->debug("\tGenerating module for owl class $name\n"); | |||||||||||||||||||||||||||
| 142 | 20 | my $module_name = $property->module_name(); | |||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||
| 144 | # create implementation specific object | ||||||||||||||||||||||||||||
| 145 | 20 | my $impl = { package => $module_name, }; | |||||||||||||||||||||||||||
| 146 | 20 | ▶ | if ( $args{outcode} ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 147 | $tt->process( | ||||||||||||||||||||||||||||
| 148 | $input, | ||||||||||||||||||||||||||||
| 149 | { | ||||||||||||||||||||||||||||
| 150 | obj => $property, | ||||||||||||||||||||||||||||
| 151 | }, | ||||||||||||||||||||||||||||
| 152 | $args{outcode} | ||||||||||||||||||||||||||||
| 153 | 0 | ▶ | ) || $LOG->logdie( $tt->error() ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 154 | } else { | ||||||||||||||||||||||||||||
| 155 | my $outfile = | ||||||||||||||||||||||||||||
| 156 | 20 | File::Spec->catfile( $outdir, split( /::/, $impl->{package} ) ) . '.pm'; | |||||||||||||||||||||||||||
| 157 | |||||||||||||||||||||||||||||
| 158 | # do not overwrite an existing file (there may be already | ||||||||||||||||||||||||||||
| 159 | # a real implementation code) | ||||||||||||||||||||||||||||
| 160 | 20 | ▶ | if ( -f $outfile and !$args{force_over} ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
-f $outfile and not $args{"force_over"}
MC/DC0%0/2
-f $outfile and not $args{"force_over"}
-f $outfile
not $args{"force_over"}
Truth table33%1/3
A and not(B)
A= -f $outfileB= not $args{"force_over"}
| |||||||||||||||||||||||||||||
| 161 | 0 | $LOG->logwarn( "Implementation '$outfile' already exists. " | |||||||||||||||||||||||||||
| 162 | . "It will *not* be re-generated. Safety reasons.\n" ); | ||||||||||||||||||||||||||||
| 163 | 0 | return; | |||||||||||||||||||||||||||
| 164 | } | ||||||||||||||||||||||||||||
| 165 | $tt->process( | ||||||||||||||||||||||||||||
| 166 | 20 | ▶ | $input, | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 167 | { | ||||||||||||||||||||||||||||
| 168 | obj => $property, | ||||||||||||||||||||||||||||
| 169 | }, | ||||||||||||||||||||||||||||
| 170 | $outfile | ||||||||||||||||||||||||||||
| 171 | ) || $LOG->logdie( $tt->error() ); | ||||||||||||||||||||||||||||
| 172 | 20 | $LOG->info("Created $outfile\n"); | |||||||||||||||||||||||||||
| 173 | } | ||||||||||||||||||||||||||||
| 174 | } | ||||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||
| 176 | #----------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 177 | # generate_datatype_property | ||||||||||||||||||||||||||||
| 178 | #----------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 179 | 10 | ▶ | sub generate_datatype_property { | ||||||||||||||||||||||||||
|
Subroutine
generate_datatype_property: called CC=7 SCAR=21.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 180 | 10 | my ( $self, @args ) = @_; | |||||||||||||||||||||||||||
| 181 | 10 | ▶ | my %args = ( # some default values | ||||||||||||||||||||||||||
|
Condition66%2/3
$OWLCFG::GENERATORS_OUTDIR || 'OWL::Utils'->find_file($OWL::Generators::GenOWL::Bin, 'generated')
MC/DC0%0/2
$OWLCFG::GENERATORS_OUTDIR || 'OWL::Utils'->find_file($OWL::Generators::GenOWL::Bin, 'generated')
$OWLCFG::GENERATORS_OUTDIR
'OWL::Utils'->find_file($OWL::Generators::GenOWL::Bin, 'generated')
Truth table66%2/3
A || B
A= $OWLCFG::GENERATORS_OUTDIRB= 'OWL::Utils'->find_file($OWL::Generators::GenOWL::Bin, 'generated')
| |||||||||||||||||||||||||||||
| 182 | impl_outdir => ( | ||||||||||||||||||||||||||||
| 183 | $OWLCFG::GENERATORS_OUTDIR || OWL::Utils->find_file( $Bin, 'generated' ) | ||||||||||||||||||||||||||||
| 184 | ), | ||||||||||||||||||||||||||||
| 185 | impl_prefix => 'OWL::Data::Property', | ||||||||||||||||||||||||||||
| 186 | force_over => 0, | ||||||||||||||||||||||||||||
| 187 | static_impl => 0, | ||||||||||||||||||||||||||||
| 188 | |||||||||||||||||||||||||||||
| 189 | # other args, with no default values | ||||||||||||||||||||||||||||
| 190 | # outcode => ref SCALAR | ||||||||||||||||||||||||||||
| 191 | # and the real parameters | ||||||||||||||||||||||||||||
| 192 | @args | ||||||||||||||||||||||||||||
| 193 | ); | ||||||||||||||||||||||||||||
| 194 | 10 | my $property = $args{property}; | |||||||||||||||||||||||||||
| 195 | 10 | $self->_check_outcode(%args); | |||||||||||||||||||||||||||
| 196 | 10 | my $outdir = File::Spec->rel2abs( $args{impl_outdir} ); | |||||||||||||||||||||||||||
| 197 | |||||||||||||||||||||||||||||
| 198 | # generate from template | ||||||||||||||||||||||||||||
| 199 | 10 | my $tt = Template->new( ABSOLUTE => 1 ); | |||||||||||||||||||||||||||
| 200 | 10 | my $input = OWL::Utils->find_file( $Bin, 'OWL', 'Generators', 'templates', | |||||||||||||||||||||||||||
| 201 | 'owl-datatype-property.tt' ); | ||||||||||||||||||||||||||||
| 202 | 10 | my $name = $property->name(); | |||||||||||||||||||||||||||
| 203 | 10 | $LOG->debug("\tGenerating datatype property for $name\n"); | |||||||||||||||||||||||||||
| 204 | 10 | my $module_name = $property->module_name(); | |||||||||||||||||||||||||||
| 205 | |||||||||||||||||||||||||||||
| 206 | # create implementation specific object | ||||||||||||||||||||||||||||
| 207 | 10 | my $impl = { package => $module_name, }; | |||||||||||||||||||||||||||
| 208 | 10 | ▶ | if ( $args{outcode} ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 209 | $tt->process( | ||||||||||||||||||||||||||||
| 210 | $input, | ||||||||||||||||||||||||||||
| 211 | { | ||||||||||||||||||||||||||||
| 212 | obj => $property, | ||||||||||||||||||||||||||||
| 213 | }, | ||||||||||||||||||||||||||||
| 214 | $args{outcode} | ||||||||||||||||||||||||||||
| 215 | 0 | ▶ | ) || $LOG->logdie( $tt->error() ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 216 | } else { | ||||||||||||||||||||||||||||
| 217 | my $outfile = | ||||||||||||||||||||||||||||
| 218 | 10 | File::Spec->catfile( $outdir, split( /::/, $impl->{package} ) ) . '.pm'; | |||||||||||||||||||||||||||
| 219 | |||||||||||||||||||||||||||||
| 220 | # do not overwrite an existing file (there may be already | ||||||||||||||||||||||||||||
| 221 | # a real implementation code) | ||||||||||||||||||||||||||||
| 222 | 10 | ▶ | if ( -f $outfile and !$args{force_over} ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
-f $outfile and not $args{"force_over"}
MC/DC0%0/2
-f $outfile and not $args{"force_over"}
-f $outfile
not $args{"force_over"}
Truth table33%1/3
A and not(B)
A= -f $outfileB= not $args{"force_over"}
| |||||||||||||||||||||||||||||
| 223 | 0 | $LOG->logwarn( "Implementation '$outfile' already exists. " | |||||||||||||||||||||||||||
| 224 | . "It will *not* be re-generated. Safety reasons.\n" ); | ||||||||||||||||||||||||||||
| 225 | 0 | return; | |||||||||||||||||||||||||||
| 226 | } | ||||||||||||||||||||||||||||
| 227 | $tt->process( | ||||||||||||||||||||||||||||
| 228 | 10 | ▶ | $input, | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 229 | { | ||||||||||||||||||||||||||||
| 230 | obj => $property, | ||||||||||||||||||||||||||||
| 231 | }, | ||||||||||||||||||||||||||||
| 232 | $outfile | ||||||||||||||||||||||||||||
| 233 | ) || $LOG->logdie( $tt->error() ); | ||||||||||||||||||||||||||||
| 234 | 10 | $LOG->debug("Created $outfile\n"); | |||||||||||||||||||||||||||
| 235 | } | ||||||||||||||||||||||||||||
| 236 | } | ||||||||||||||||||||||||||||
| 237 | |||||||||||||||||||||||||||||
| 238 | #----------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 239 | # _check_outcode | ||||||||||||||||||||||||||||
| 240 | # throws an exception if %args has an 'outcode' of a wrong type | ||||||||||||||||||||||||||||
| 241 | #----------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 242 | 36 | ▶ | sub _check_outcode { | ||||||||||||||||||||||||||
|
Subroutine
_check_outcode: called CC=3 SCAR=13.1
| |||||||||||||||||||||||||||||
| 243 | 36 | my ( $self, %args ) = @_; | |||||||||||||||||||||||||||
| 244 | $self->throw("Parameter 'outcode' should be a reference to a SCALAR.") | ||||||||||||||||||||||||||||
| 245 | 36 | ▶ | if $args{outcode} and ref( $args{outcode} ) ne 'SCALAR'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$args{"outcode"} and ref $args{"outcode"} ne "SCALAR"
MC/DC0%0/2
$args{"outcode"} and ref $args{"outcode"} ne "SCALAR"
$args{"outcode"}
ref $args{"outcode"} ne "SCALAR"
Truth table33%1/3
A and B
A= $args{"outcode"}B= ref $args{"outcode"} ne "SCALAR"
| |||||||||||||||||||||||||||||
| 246 | } | ||||||||||||||||||||||||||||
| 247 | 2 | 1; | |||||||||||||||||||||||||||
| 248 | __END__ | ||||||||||||||||||||||||||||