| 1 | 1 | ▶ | use v5.6; | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 2 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 4 | 1 | ▶ | use Tie::Scalar; | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||
| 6 | package Tie::Wx::Widget; | ||||||||||||||||||||||||||||||||||
| 7 | 1 | our $VERSION = '1.01'; | |||||||||||||||||||||||||||||||||
| 8 | 1 | our @ISA = 'Tie::Scalar'; | |||||||||||||||||||||||||||||||||
| 9 | 1 | our $complainmethod = 'die'; | |||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||
| 11 | 1 | ▶ | sub import { $complainmethod = 'warn_mode' if defined $_[1] and $_[1] eq 'warn'} | ||||||||||||||||||||||||||||||||
|
Subroutine
import: called CC=3 SCAR=14.2
Branch: 1 branch
Condition33%1/3
defined $_[1] and $_[1] eq "warn"
MC/DC0%0/2
defined $_[1] and $_[1] eq "warn"
defined $_[1]
$_[1] eq "warn"
Truth table33%1/3
A and B
A= defined $_[1]B= $_[1] eq "warn"
| |||||||||||||||||||||||||||||||||||
| 12 | 0 | ▶ | sub die_mode { $complainmethod = 'die'} | ||||||||||||||||||||||||||||||||
|
Subroutine
die_mode: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||
| 13 | 0 | ▶ | sub warn_mode{ $complainmethod = 'warn'} | ||||||||||||||||||||||||||||||||
|
Subroutine
warn_mode: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||
| 14 | 0 | ▶ | sub complain { $complainmethod eq 'die' ? die $_[0] : warn $_[0] } | ||||||||||||||||||||||||||||||||
|
Subroutine
complain: not called CC=2 SCAR=17.9
Pod
undocumented
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||
| 16 | 0 | ▶ | sub TIESCALAR { | ||||||||||||||||||||||||||||||||
|
Subroutine
TIESCALAR: not called CC=12 SCAR=50.5
| |||||||||||||||||||||||||||||||||||
| 17 | 0 | my ($self, $widget, $store, $fetch) = @_; | |||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||
| 19 | 0 | ▶ | if (not ref $widget) {complain("$widget isn't even a referece, has to a Wx object")} | ||||||||||||||||||||||||||||||||
|
Branch: 7 branches
| |||||||||||||||||||||||||||||||||||
| 20 | 0 | elsif (index($widget, '=') == -1) {complain("$widget isn't even an object, has to a Wx object")} | |||||||||||||||||||||||||||||||||
| 21 | 0 | elsif (not $widget->isa('Wx::Control')) {complain("$widget is no Wx widget")} | |||||||||||||||||||||||||||||||||
| 22 | 0 | elsif (not $widget->can('GetValue')) {complain("$widget has no method: GetValue")} | |||||||||||||||||||||||||||||||||
| 23 | 0 | elsif (not $widget->can('SetValue')) {complain("$widget has no method: SetValue")} | |||||||||||||||||||||||||||||||||
| 24 | 0 | ▶ | elsif (defined $store and ref $store ne 'CODE'){complain("no coderef as STORE callback")} | ||||||||||||||||||||||||||||||||
|
Condition0%0/3
defined $store and ref $store ne "CODE"
MC/DC0%0/2
defined $store and ref $store ne "CODE"
defined $store
ref $store ne "CODE"
Truth table0%0/3
A and B
A= defined $storeB= ref $store ne "CODE"
| |||||||||||||||||||||||||||||||||||
| 25 | 0 | ▶ | elsif (defined $fetch and ref $fetch ne 'CODE'){complain("no coderef as FETCH callback")} | ||||||||||||||||||||||||||||||||
|
Condition0%0/3
defined $fetch and ref $fetch ne "CODE"
MC/DC0%0/2
defined $fetch and ref $fetch ne "CODE"
defined $fetch
ref $fetch ne "CODE"
Truth table0%0/3
A and B
A= defined $fetchB= ref $fetch ne "CODE"
| |||||||||||||||||||||||||||||||||||
| 26 | else { | ||||||||||||||||||||||||||||||||||
| 27 | 0 | my %hash = ('w' => $widget, 'widget' => $widget); | |||||||||||||||||||||||||||||||||
| 28 | 0 | ▶ | $hash{'store'} = $store if defined $store; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 29 | 0 | ▶ | $hash{'fetch'} = $fetch if defined $fetch; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 30 | 0 | return bless \%hash, $self; | |||||||||||||||||||||||||||||||||
| 31 | } | ||||||||||||||||||||||||||||||||||
| 32 | 0 | return 0; | |||||||||||||||||||||||||||||||||
| 33 | } | ||||||||||||||||||||||||||||||||||
| 34 | 0 | ▶ | sub FETCH { | ||||||||||||||||||||||||||||||||
|
Subroutine
FETCH: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||
| 35 | 0 | ▶ | if (exists $_[0]->{'fetch'}) { &{$_[0]->{'fetch'}}( $_[0]->{'w'} ) } | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 36 | 0 | else { return $_[0]->{'w'}->GetValue } | |||||||||||||||||||||||||||||||||
| 37 | } | ||||||||||||||||||||||||||||||||||
| 38 | 0 | ▶ | sub STORE { | ||||||||||||||||||||||||||||||||
|
Subroutine
STORE: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||
| 39 | 0 | ▶ | return 0 if ref $_[1]; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 40 | 0 | ▶ | if (exists $_[0]->{'store'}) { &{$_[0]->{'store'}}( $_[0]->{'w'}, $_[1] ) } | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 41 | 0 | else { return $_[0]->{'w'}->SetValue( $_[1] ) } | |||||||||||||||||||||||||||||||||
| 42 | } | ||||||||||||||||||||||||||||||||||
| 43 | 0 | ▶ | sub UNTIE {} # to prevent crashes if called | ||||||||||||||||||||||||||||||||
|
Subroutine
UNTIE: not called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 44 | 0 | ▶ | sub DESTROY {} # to prevent crashes if called | ||||||||||||||||||||||||||||||||
|
Subroutine
DESTROY: not called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||||||||
| 46 | 1 | 'one'; | |||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||||
| 48 | __END__ | ||||||||||||||||||||||||||||||||||