ExtDirect/Test/Pkg/JuiceBar.pm untested

filter: Statementstmt 0.0% 0 / 38 Branchbran 0.0% 0 / 6 Conditioncond 0.0% 0 / 3 MC/DCmcdc n/a Subroutinesub 0.0% 0 / 9 Podpod 0.0% 0 / 3 totaltotal 0.0% 0 / 59 CC 4 SCAR 20.8
CC
4
Cov
0%
bar_baz
20.0
bar_foo
2.0
bar_bar
2.0
CRAP 8.0
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 # This does not need to be indexed by PAUSE
13 package
14 RPC::ExtDirect::Test::Pkg::JuiceBar;
15  
16 use strict;
17 use warnings;
18 no warnings 'uninitialized';
19  
20 use base 'RPC::ExtDirect::Test::Pkg::Foo';
21  
22 use RPC::ExtDirect;
23  
24 use Carp;
25  
26 our $CHEAT = 0;
27  
28 # This one croaks merrily
29 sub bar_foo : ExtDirect(4) { croak 'bar foo!' }
30  
31 # Return number of passed arguments
32 sub bar_bar : ExtDirect(5) { shift; pop; return scalar @_; }
33  
34 # This is a form handler
35 sub bar_baz : ExtDirect(formHandler) {
36 my ($class, %param) = @_;
37  
38 # We don't use the env object here, but have to remove it
39 # so that it doesn't leak in the response
40 my $env = delete $param{_env};
41  
42 # Simulate uploaded file handling
43 my $uploads = $param{file_uploads};
44 return \%param unless $uploads;
45  
46 # Return 'uploads' data
47 my $response = "The following files were processed:\n";
48 for my $upload ( @$uploads ) {
49 my $name = $upload->{basename};
50 my $type = $upload->{type};
51 my $size = $upload->{size};
52
53 #
54 # CGI::Test somehow uploads files so that
55 # they are 2 bytes shorter than actual size
56 # This allows for the same test results to be
57 # applied across all gateways and test frameworks
58 #
59 # TODO Investigate why this is happening and fix
60 #
61 $size += 2 if $CHEAT;
62  
63 my $ok = (defined $upload->{handle} &&
64 $upload->{handle}->opened) ? "ok" : "not ok";
65  
66 $response .= "$name $type $size $ok\n";
67 };
68  
69 delete $param{file_uploads};
70 $param{upload_response} = $response;
71  
72 return \%param;
73 }
74  
75 1;