File Coverage

blib/lib/FBP/CustomControl.pm
Criterion Covered Total %
statement 18 26 69.2
branch 4 12 33.3
condition 2 12 16.6
subroutine 4 4 100.0
pod 2 2 100.0
total 30 56 53.5


line stmt bran cond sub pod time code
1             package FBP::CustomControl;
2              
3 4     4   22 use Mouse;
  4         5  
  4         27  
4              
5             our $VERSION = '0.41';
6              
7             extends 'FBP::Window';
8              
9             has class => (
10             is => 'ro',
11             isa => 'Str',
12             );
13              
14             has declaration => (
15             is => 'ro',
16             isa => 'Str',
17             );
18              
19             has construction => (
20             is => 'ro',
21             isa => 'Str',
22             );
23              
24             has include => (
25             is => 'ro',
26             isa => 'Str',
27             );
28              
29             has settings => (
30             is => 'ro',
31             isa => 'Str',
32             );
33              
34 4     4   1344 no Mouse;
  4         8  
  4         15  
35             __PACKAGE__->meta->make_immutable;
36              
37              
38              
39              
40             ######################################################################
41             # Wx::Window Methods
42              
43             sub wxclass {
44 1     1 1 688 my $self = shift;
45              
46             # If a custom class is defined, use it literally
47 1         11 my $subclass = $self->subclass;
48 1 50       6 if ( length $subclass ) {
49 0         0 my ($wxclass, $header) = split /\s*;\s*/, $subclass;
50 0 0 0     0 if ( defined $wxclass and length $wxclass ) {
51 0         0 return $wxclass;
52             }
53             }
54              
55             # Fall through to the explicit class property
56 1         5 my $explicit = $self->class;
57 1 50 33     14 if ( defined $explicit and length $explicit ) {
58 1         5 return $explicit;
59             }
60              
61             # No idea what to do at this point...
62 0         0 die 'Failed to derive Wx class from FBP class';
63             }
64              
65             sub header {
66 1     1 1 4 my $self = shift;
67              
68             # If a custom class is defined, use it literally
69 1         5 my $subclass = $self->subclass;
70 1 50       4 if ( length $subclass ) {
71 0         0 my ($wxclass, $header) = split /\s*;\s*/, $subclass;
72 0 0 0     0 if ( defined $header and length $header ) {
73 0         0 return $header;
74             }
75             }
76              
77             # Fall through to the explicit include string
78 1         5 my $explicit = $self->include;
79 1 50 33     10 if ( defined $explicit and length $explicit ) {
80 1         5 return $explicit;
81             }
82              
83             # If there is no explicit header to load, don't load anything
84 0           return;
85             }
86              
87             1;