ExtDirect/Test/Pkg/PollProvider.pm

filter: Statementstmt 100% 39 / 39 Branchbran 100% 8 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 12 / 12 Podpod 0.0% 0 / 1 totaltotal 98.3% 59 / 60 CC 5 SCAR 8.1
CC
5
Cov
100%
foo
5.0
BEGIN
1.0
BEGIN
1.0
CRAP 2.2
« ExtDirect/Serializer.pm ↑ Summary ExtDirect/Util/Accessor.pm »
1 #
2 # WARNING WARNING WARNING
3 #
4 # DO NOT CHANGE ANYTHING IN THIS MODULE. OTHERWISE, A LOT OF API
5 # AND OTHER TESTS MAY BREAK.
6 #
7 # This module is here to test certain behaviors. If you need
8 # to test something else, add another test module.
9 # It's that simple.
10 #
11  
12 package # avoid indexing by the nosy PAUSE
13 TheBug;
14  
15 5 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
16 5 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
17  
18 1 ▶sub new { bless { message => $_[1] }, $_[0] }
Subroutine new: called CC=1 SCAR=0.0
19 1 ▶sub result { $_[0] }
Subroutine result: called CC=1 SCAR=0.0
20  
21 package
22 RPC::ExtDirect::Test::Pkg::PollProvider;
23  
24 5 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
25 5 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
26 5 ▶no warnings 'uninitialized';
Subroutine BEGIN: called CC=1 SCAR=0.0
27  
28 5 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
29  
30 5 ▶use RPC::ExtDirect;
Subroutine BEGIN: called CC=1 SCAR=0.0
31 5 ▶use RPC::ExtDirect::Event;
Subroutine BEGIN: called CC=1 SCAR=0.0
32  
33 # This is to control what gets returned
34 5 our $WHAT_YOURE_HAVING = 'Usual, please';
35  
36 7 ▶sub foo : ExtDirect( pollHandler ) {
Subroutine foo: called CC=5 SCAR=16.1
Pod undocumented
37 7 my ($class) = @_;
38  
39 # There ought to be something more substantive, but...
40 7 ▶ if ( $WHAT_YOURE_HAVING eq 'Usual, please' ) {
Branch: 4 branches
BranchTrueFalseTotal
if ($RPC::ExtDirect::Test::Pkg::PollProvider::WHAT_YOURE_HAVING eq 'Usual, please') { } 3 4 7
elsif ($RPC::ExtDirect::Test::Pkg::PollProvider::WHAT_YOURE_HAVING eq 'Ein kaffe bitte') { } 1 3 4
elsif ($RPC::ExtDirect::Test::Pkg::PollProvider::WHAT_YOURE_HAVING eq 'Whiskey, straight away!') { } 1 2 3
elsif ($RPC::ExtDirect::Test::Pkg::PollProvider::WHAT_YOURE_HAVING eq q[Hey man! There's a roach in my soup!]) { } 1 1 2
41 return (
42 3 RPC::ExtDirect::Event->new('foo_event', [ 'foo' ]),
43 RPC::ExtDirect::Event->new('bar_event', { foo => 'bar' }),
44 );
45 }
46  
47 elsif ( $WHAT_YOURE_HAVING eq 'Ein kaffe bitte' ) {
48 return (
49 1 RPC::ExtDirect::Event->new('coffee',
50 'Uno cappuccino, presto!'),
51 );
52 }
53  
54 elsif ( $WHAT_YOURE_HAVING eq 'Whiskey, straight away!' ) {
55 1 croak "Burp!";
56 }
57  
58 elsif ( $WHAT_YOURE_HAVING eq "Hey man! There's a roach in my soup!" ) {
59 1 my $bug = new TheBug 'TIGER ROACH!! WHOA!';
60 1 return $bug;
61 }
62  
63 else {
64 # Nothing special to report in our Special News Report!
65 1 return ();
66 };
67 5 ▶}
Subroutine BEGIN: called CC=1 SCAR=0.0
68  
69 5 1;
« ExtDirect/Serializer.pm ↑ Summary ExtDirect/Util/Accessor.pm »