File Coverage

blib/lib/SOAP/Transport/HTTP/Plack.pm
Criterion Covered Total %
statement 10 12 83.3
branch n/a
condition n/a
subroutine 4 4 100.0
pod n/a
total 14 16 87.5


line stmt bran cond sub pod time code
1             package SOAP::Transport::HTTP::Plack;
2              
3 1     1   54994 use 5.006;
  1         4  
  1         42  
4 1     1   7 use strict;
  1         2  
  1         42  
5 1     1   6 use warnings;
  1         7  
  1         38  
6              
7 1     1   855 use SOAP::Transport::HTTP;
  0            
  0            
8             use base qw(SOAP::Transport::HTTP::Server);
9              
10             =head1 NAME
11              
12             SOAP::Transport::HTTP::Plack - transport for Plack (http://search.cpan.org/~miyagawa/Plack/) PSGI toolkit for SOAP::Lite module.
13              
14             The module is quite similar to SOAP::Transport::HTTP::Apache.
15              
16             Docs were stolen completely from SOAP::Transport::HTTP::Nginx.
17              
18             =head1 VERSION
19              
20             Version 0.03
21              
22             =cut
23              
24             our $VERSION = '0.03';
25              
26              
27             =head1 SYNOPSIS
28              
29             Provide support for HTTP Plack transport.
30              
31             =head1 FUNCTIONS
32              
33             =over
34              
35             =item DESTROY
36              
37             Destructor. Add tracing if object was initialized so.
38              
39             =cut
40             sub DESTROY { SOAP::Trace::objects('()') }
41              
42             =item new
43              
44             Constructor. "Autocalled" from server side.
45              
46             =cut
47             sub new {
48             my $self = shift;
49              
50             unless (ref $self) {
51             my $class = ref($self) || $self;
52             $self = $class->SUPER::new(@_);
53             SOAP::Trace::objects('()');
54             }
55             return $self;
56             }
57              
58             =item handler
59              
60             Handler server function. "Autocalled" from server side.
61              
62             =cut
63             sub handler {
64             my $self = shift->new;
65             my $r = shift;
66              
67             $self->request(HTTP::Request->new(
68             $r->method => $r->uri,
69             $r->headers,
70             do { $r->content; }
71             ));
72             $self->SUPER::handle;
73              
74             my $code = $self->response->code;
75             my @headers;
76             $self->response->headers->scan(sub { push @headers, @_ });
77             return [$code, \@headers, [$self->response->content] ];
78             }
79              
80             =item handle
81              
82             Alias for handler.
83              
84             =cut
85              
86             {
87             #just create alias
88             sub handle;
89             *handle = \&handler
90             }
91              
92             =back
93              
94             =head1 AUTHOR
95              
96             Elena Bolshakova, C<< >>
97              
98             =head1 BUGS
99              
100             Please report any bugs or feature requests to C, or through
101             the web interface at L. I will be notified, and then you'll
102             automatically be notified of progress on your bug as I make changes.
103              
104              
105             =head1 SUPPORT
106              
107             You can find documentation for this module with the perldoc command.
108              
109             perldoc SOAP::Transport::HTTP::Plack
110              
111              
112             You can also look for information at:
113              
114             =over 4
115              
116             =item * RT: CPAN's request tracker (report bugs here)
117              
118             L
119              
120             =item * AnnoCPAN: Annotated CPAN documentation
121              
122             L
123              
124             =item * CPAN Ratings
125              
126             L
127              
128             =item * Search CPAN
129              
130             L
131              
132             =back
133              
134              
135             =head1 ACKNOWLEDGEMENTS
136              
137              
138             =head1 LICENSE AND COPYRIGHT
139              
140             Copyright 2012 Elena Bolshakova.
141              
142             This program is free software; you can redistribute it and/or modify it
143             under the same terms as Perl itself.
144              
145             See http://dev.perl.org/licenses/ for more information.
146              
147             =cut
148              
149             1; # End of SOAP::Transport::HTTP::Plack