Essex/Constants.pm

filter: Statementstmt 100% 22 / 22 Branchbran 45.0% 9 / 20 Conditioncond 35.7% 5 / 14 MC/DCmcdc 0.0% 0 / 7 Subroutinesub 100% 4 / 4 Podpod 100% 1 / 1 totaltotal 60.2% 41 / 68 CC 7 SCAR 15.3
CC
7
Cov
64%
BEGIN
7.0
import
4.0
threaded_essex
1.2
CRAP 4.6
« Generator/Essex.pm ↑ Summary Essex/Model.pm »
1 package XML::Essex::Constants;
2  
3 10 $VERSION = 0.000_1;
4  
5 =head1 NAME
6  
7 XML::Essex::Constants - Export a few constants used within Essex
8  
9 =head1 SYNOPSIS
10  
11 use XML::Essex::Constants;
12  
13 =head1 DESCRIPTION
14  
15 This is really for internal use only and is not needed by outside
16 callers. Subclasses of XML::Filter::Handler may also need this.
17  
18 Hacker's note: see the source for some minor magic used in debugging
19 and testing.
20  
21 =over
22  
23 =cut
24  
25 11 ▶use Carp qw( croak );
Subroutine BEGIN: called CC=1 SCAR=0.0
26  
27 my %exports = map {
28 10 ( $_ => undef );
29 } qw( BOD EOD debugging SEPPUKU threaded_essex );
30  
31 27 ▶sub import {
Subroutine import: called CC=4 SCAR=13.9
32 27 my $class = shift;
33 27 my $caller = caller;
34 51 *{"${caller}::$_"} = \&$_
35 27 ▶ for ! @_
Branch: 1 branch
BranchTrueFalseTotal
!@_ ? : 6 21 27
36 ? keys %exports
37 : grep {
38 21 ▶ exists $exports{$_} || croak "$_ not exported by $class";
Condition50%1/2
exists $exports{$_} || croak("$_ not exported by $class")
l!l
210
MC/DC0%0/1
exists $exports{$_} || croak("$_ not exported by $class")
exists $exports{$_}
Truth table50%1/2
A
A= exists $exports{$_}
Aresult
11
00
39 } @_;
40 }
41  
42 =item debugging
43  
44 Returns 1 if $ENV{ESSEXDEBUG}, for now.
45  
46 =cut
47  
48 11 ▶BEGIN {
Subroutine BEGIN: called CC=4 SCAR=19.4
49 eval join
50 $ENV{ESSEXDEBUG}
51 11 ▶ ? $ENV{ESSEXDEBUG} eq "VARY"
Branch: 3 branches
BranchTrueFalseTotal
eval join($ENV{"ESSEXDEBUG"} ? $ENV{"ESSEXDEBUG"} eq "VARY" ? "\$ENV{ESSEXDEBUG}" : 1 : 0, "sub debugging() {", "} 1") or die $@ 11 0 11
$ENV{'ESSEXDEBUG'} ? : 0 11 11
$ENV{'ESSEXDEBUG'} eq 'VARY' ? : 0 0 0
52 ? '$ENV{ESSEXDEBUG}'
53 : 1
54 : 0,
55 "sub debugging() {",
56 "} 1"
57 or die $@;
58 }
59  
60 =item BOD
61  
62 BOD is an event sent before the first event (a set_document_locator or
63 start_document) in a document. It is used to sync up the slave
64 thread. Right now, this means that any events before the first
65 set_document_locator or start_document are lost.
66  
67 =cut
68  
69 sub BOD() { "start of XML document" }
70  
71 =item EOD
72  
73 EOD is sent after the end_document to flag the fact that there
74 are no more events coming. This is not necessary, as the child
75 could trigger off the end_document, but it is convenient because
76 the child does not need to maintain any EndDocumentSeen state.
77 It also opens up the door for a "reset" method on the parent to force
78 the child's main() to exit, if we ever need that.
79  
80 =cut
81  
82 sub EOD() { "end of XML document" }
83  
84 =item SEPPUKU
85  
86 SEPPUKU is sent if the parent is DESTROYed so the child thread may
87 follow it in to oblivion, with honor.
88  
89 =cut
90  
91 sub SEPPUKU() { "end of parent life" }
92  
93 =item threaded_essex
94  
95 Returns 1 if Essex should use threads.
96  
97 =cut
98  
99 10 our $threading; ## Used only by t/XML-Handler-Essex-Threaded.t
100  
101 eval join
102 exists $threads::{VERSION}
103 10 ▶ && defined $threads::VERSION
Subroutine threaded_essex: called CC=1 SCAR=1.6
Pod documented
Branch: 6 branches
BranchTrueFalseTotal
eval join(exists $main::threads::{"VERSION"} && defined $threads::VERSION && $threads::VERSION >= "0.99" ? defined $threading ? "\$threading" : 1 : 0, "sub threaded_essex() {", "} 1") or die $@ 10 0 10
exists $main::threads::{'VERSION'} && defined $threads::VERSION && $threads::VERSION >= 0.99 ? : 0 10 10
defined $threading ? : 0 0 0
eval join(exists $main::threads::{"VERSION"} && defined $threads::VERSION && $threads::VERSION >= "0.99" ? defined $threading ? "\$threading" : 1 : 0, "sub threaded_essex() {", "} 1") or die $@ 1 0 1
exists $main::threads::{'VERSION'} && defined $threads::VERSION && $threads::VERSION >= 0.99 ? : 1 0 1
defined $threading ? : 1 0 1
Condition33%4/12
exists $main::threads::{"VERSION"} and defined $threads::VERSION and $threads::VERSION >= "0.99"
!ll&&!rl&&r
1000
exists $main::threads::{"VERSION"} and defined $threads::VERSION
!ll&&!rl&&r
0100
exists $main::threads::{"VERSION"} and defined $threads::VERSION and $threads::VERSION >= "0.99"
!ll&&!rl&&r
001
exists $main::threads::{"VERSION"} and defined $threads::VERSION
!ll&&!rl&&r
001
MC/DC0%0/3
exists $main::threads::{"VERSION"} and defined $threads::VERSION and $threads::VERSION >= "0.99"
exists $main::threads::{"VERSION"} defined $threads::VERSION $threads::VERSION >= "0.99"
MC/DC0%0/3
exists $main::threads::{"VERSION"} and defined $threads::VERSION and $threads::VERSION >= "0.99"
exists $main::threads::{"VERSION"} defined $threads::VERSION $threads::VERSION >= "0.99"
Truth table25%1/4
A and B and C
A= exists $main::threads::{"VERSION"}B= defined $threads::VERSIONC= $threads::VERSION >= "0.99"
ABCresult
0XX0
10X0
1100
1111
Truth table25%1/4
A and B and C
A= exists $main::threads::{"VERSION"}B= defined $threads::VERSIONC= $threads::VERSION >= "0.99"
ABCresult
0XX0
10X0
1100
1111
104 && $threads::VERSION >= 0.99
105 ? defined $threading
106 ? '$threading'
107 : 1
108 : 0,
109  
110 "sub threaded_essex() {",
111 "} 1"
112 or die $@;
113  
114 =back
115  
116 =head1 LIMITATIONS
117  
118 Does not pay attention to the parameter list passed with use(). This
119 is speedy and light, but not kind. It's for internal use only, however,
120 and this should be sufficient.
121  
122 =head1 COPYRIGHT
123  
124 Copyright 2002, R. Barrie Slaymaker, Jr., All Rights Reserved
125  
126 =head1 LICENSE
127  
128 You may use this module under the terms of the BSD, Artistic, oir GPL licenses,
129 any version.
130  
131 =head1 AUTHOR
132  
133 Barrie Slaymaker <barries@slaysys.com>
134  
135 =cut
136  
137 10 1;
« Generator/Essex.pm ↑ Summary Essex/Model.pm »