| 1 | package Config::Strict::UserConstraints; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | 6 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 3 | 6 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||||||||||
| 5 | 6 | our $VERSION = '0.07'; | |||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||
| 7 | 6 | ▶ | use Carp qw(confess); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 8 | 6 | ▶ | use Declare::Constraints::Simple-Library; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||||||
| 10 | #__PACKAGE__->install_into( 'Config::Strict' ); | ||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||
| 12 | 4 | ▶ | sub make_constraint { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
make_constraint: called CC=6 SCAR=20.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 13 | 4 | my ( $class, $name, $sub, $message ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 14 | # $name ||= '__ANON__'; TODO? | ||||||||||||||||||||||||||||||||||||||||||
| 15 | 4 | ▶ | confess "No name" unless $name; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 16 | 4 | ▶ | confess "Not a coderef" unless $sub and ref $sub and ref $sub eq 'CODE'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
$sub and ref $sub and ref $sub eq "CODE"
$sub and ref $sub
MC/DC0%0/3
$sub and ref $sub and ref $sub eq "CODE"
$sub
ref $sub
ref $sub eq "CODE"
Truth table25%1/4
A and B and C
A= $subB= ref $subC= ref $sub eq "CODE"
| |||||||||||||||||||||||||||||||||||||||||||
| 17 | 4 | ▶ | $message ||= "Value doesn't pass $name constraint"; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$message ||= "Value doesn't pass $name constraint"
MC/DC0%0/1
$message ||= "Value doesn't pass $name constraint"
$message
Truth table50%1/2
A
A= $message
| |||||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||
| 19 | # print "Making constraint $name...\n"; | ||||||||||||||||||||||||||||||||||||||||||
| 20 | # This just registers $name as a DCS constraint and returns true: | ||||||||||||||||||||||||||||||||||||||||||
| 21 | constraint( | ||||||||||||||||||||||||||||||||||||||||||
| 22 | 19 | ▶ | $name => sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 23 | # _result( $sub->( @_ ), $message ); | ||||||||||||||||||||||||||||||||||||||||||
| 24 | 19 | ▶ | $sub->( @_ ) ? _true : _false( $message ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 25 | } | ||||||||||||||||||||||||||||||||||||||||||
| 26 | 4 | ); | |||||||||||||||||||||||||||||||||||||||||
| 27 | } | ||||||||||||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||||||||||||
| 29 | 6 | 1; | |||||||||||||||||||||||||||||||||||||||||