Eve/HttpOutput.pm

filter: Statementstmt 52.6% 10 / 19 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 60.0% 3 / 5 Podpod 100% 2 / 2 totaltotal 57.6% 15 / 26 CC 1 SCAR 3.4
CC
1
Cov
53%
init
2.0
handle
2.0
BEGIN
1.0
CRAP 1.4
« Eve/Session.pm ↑ Summary Eve/Geometry.pm »
1 package Eve::HttpOutput;
2  
3 9 ▶use parent qw(Eve::Class);
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 9 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 9 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 =head1 NAME
9  
10 B<Eve::HttpOutput> - an event handler for HTTP response events.
11  
12 =head1 SYNOPSIS
13  
14 use Eve::HttpOuput;
15  
16 my $output = Eve::HttpOutput->new(filehandle => STDOUT);
17 $dispatcher->handle(event => $event);
18  
19 =head1 DESCRIPTION
20  
21 B<Eve::HttpOutput> class is an output controller for HTTP
22 applications.
23  
24 =head3 Constructor arguments
25  
26 =over 3
27  
28 =item C<filehandle>
29  
30 a filehandle to write the output data to. Usualy it is STDOUT,
31  
32 =back
33  
34 =head1 METHODS
35  
36 =head2 B<init()>
37  
38 =cut
39  
40 0 ▶sub init {
Subroutine init: not called CC=1 SCAR=6.9
Pod documented
41 0 my ($self, %arg_hash) = @_;
42 0 Eve::Support::arguments(
43 \%arg_hash, my $filehandle);
44  
45 0 $self->{'_filehandle'} = $filehandle;
46  
47 0 return;
48 }
49  
50 =head2 B<handle()>
51  
52 Handles an event containing an HTTP response instance performing the
53 output.
54  
55 =head3 Arguments
56  
57 =over 4
58  
59 =item C<event>
60  
61 an event containing the HTTP response object.
62  
63 =back
64  
65 =cut
66  
67 0 ▶sub handle {
Subroutine handle: not called CC=1 SCAR=6.9
Pod documented
68 0 my ($self, %arg_hash) = @_;
69 0 Eve::Support::arguments(\%arg_hash, my $event);
70  
71 0 print {$self->_filehandle} $event->response->get_text();
72  
73 0 return;
74 }
75  
76 =head1 SEE ALSO
77  
78 =over 4
79  
80 =item L<Eve::Class>
81  
82 =item L<Eve::HttpResponse>
83  
84 =back
85  
86 =head1 LICENSE AND COPYRIGHT
87  
88 Copyright 2012 Igor Zinovyev.
89  
90 This program is free software; you can redistribute it and/or modify it
91 under the terms of either: the GNU General Public License as published
92 by the Free Software Foundation; or the Artistic License.
93  
94 See http://dev.perl.org/licenses/ for more information.
95  
96  
97 =head1 AUTHOR
98  
99 =over 4
100  
101 =item L<Igor Zinovyev|mailto:zinigor@gmail.com>
102  
103 =back
104  
105 =cut
106  
107 9 1;
« Eve/Session.pm ↑ Summary Eve/Geometry.pm »