File Coverage

blib/lib/RPC/ExtDirect/Test/Pkg/PollProvider.pm
Criterion Covered Total %
statement 37 37 100.0
branch 8 8 100.0
condition n/a
subroutine 12 12 100.0
pod 0 1 0.0
total 57 58 98.2


line stmt bran cond sub pod time code
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     5   14861 use strict;
  5         5  
  5         126  
16 5     5   18 use warnings;
  5         6  
  5         335  
17              
18 1     1   3 sub new { bless { message => $_[1] }, $_[0] }
19 1     1   4 sub result { $_[0] }
20              
21             package
22             RPC::ExtDirect::Test::Pkg::PollProvider;
23              
24 5     5   21 use strict;
  5         7  
  5         125  
25 5     5   22 use warnings;
  5         6  
  5         167  
26 5     5   15 no warnings 'uninitialized';
  5         4  
  5         119  
27              
28 5     5   17 use Carp;
  5         5  
  5         280  
29              
30 5     5   335 use RPC::ExtDirect;
  5         7  
  5         22  
31 5     5   1834 use RPC::ExtDirect::Event;
  5         10  
  5         726  
32              
33             # This is to control what gets returned
34             our $WHAT_YOURE_HAVING = 'Usual, please';
35              
36             sub foo : ExtDirect( pollHandler ) {
37 7     7 0 9 my ($class) = @_;
38              
39             # There ought to be something more substantive, but...
40 7 100       27 if ( $WHAT_YOURE_HAVING eq 'Usual, please' ) {
    100          
    100          
    100          
41             return (
42 3         16 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         3 RPC::ExtDirect::Event->new('coffee',
50             'Uno cappuccino, presto!'),
51             );
52             }
53              
54             elsif ( $WHAT_YOURE_HAVING eq 'Whiskey, straight away!' ) {
55 1         122 croak "Burp!";
56             }
57              
58             elsif ( $WHAT_YOURE_HAVING eq "Hey man! There's a roach in my soup!" ) {
59 1         5 my $bug = new TheBug 'TIGER ROACH!! WHOA!';
60 1         4 return $bug;
61             }
62              
63             else {
64             # Nothing special to report in our Special News Report!
65 1         4 return ();
66             };
67 5     5   23 }
  5         6  
  5         25  
68              
69             1;