| 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
| |||||||||||||||||||||||
| 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; | |||||||||||||||||||||