line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
148218
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
63
|
|
2
|
1
|
50
|
|
1
|
|
8
|
BEGIN{ if (not $] < 5.006) { require warnings; warnings->import } } |
|
1
|
|
|
|
|
6
|
|
|
1
|
|
|
|
|
58
|
|
3
|
|
|
|
|
|
|
package Test::Reporter::Transport::HTTPGateway; |
4
|
|
|
|
|
|
|
our $VERSION = '1.59'; # VERSION |
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
5
|
use Test::Reporter::Transport 1.58; |
|
1
|
|
|
|
|
55
|
|
|
1
|
|
|
|
|
42
|
|
7
|
|
|
|
|
|
|
our @ISA = qw/Test::Reporter::Transport/; |
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
7
|
use LWP::UserAgent; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
397
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub new { |
12
|
2
|
|
|
2
|
1
|
3426
|
my ($class, $url, $key) = @_; |
13
|
|
|
|
|
|
|
|
14
|
2
|
50
|
|
|
|
17
|
die "invalid gateway URL: must be absolute http or https URL" |
15
|
|
|
|
|
|
|
unless $url =~ /\Ahttps?:/i; |
16
|
|
|
|
|
|
|
|
17
|
2
|
|
|
|
|
14
|
bless { gateway => $url, key => $key } => $class; |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub send { |
21
|
2
|
|
|
2
|
1
|
10
|
my ($self, $report) = @_; |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
# construct the "via" |
24
|
2
|
|
|
|
|
6
|
my $report_class = ref $report; |
25
|
2
|
|
|
|
|
22
|
my $report_version = $report->VERSION; |
26
|
2
|
|
|
|
|
9
|
my $via = "$report_class $report_version"; |
27
|
2
|
50
|
|
|
|
34
|
$via .= ', via ' . $report->via if $report->via; |
28
|
2
|
|
|
|
|
197
|
my $perl_version = $report->perl_version->{_version}; |
29
|
|
|
|
|
|
|
# post the report |
30
|
2
|
|
|
|
|
26
|
my $ua = LWP::UserAgent->new; |
31
|
2
|
|
|
|
|
23
|
$ua->timeout(60); |
32
|
2
|
|
|
|
|
30
|
$ua->env_proxy; |
33
|
|
|
|
|
|
|
|
34
|
2
|
|
|
|
|
20
|
my $form = { |
35
|
|
|
|
|
|
|
key => $self->{key}, |
36
|
|
|
|
|
|
|
via => $via, |
37
|
|
|
|
|
|
|
perl_version => $perl_version, |
38
|
|
|
|
|
|
|
from => $report->from, |
39
|
|
|
|
|
|
|
subject => $report->subject, |
40
|
|
|
|
|
|
|
report => $report->report, |
41
|
|
|
|
|
|
|
}; |
42
|
|
|
|
|
|
|
|
43
|
2
|
|
|
|
|
88
|
my $res = $ua->post($self->{gateway}, $form); |
44
|
|
|
|
|
|
|
|
45
|
2
|
100
|
|
|
|
23
|
return 1 if $res->is_success; |
46
|
|
|
|
|
|
|
|
47
|
1
|
|
|
|
|
9
|
die sprintf "HTTP error: %s: %s", $res->status_line, $res->content; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
1; |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
# ABSTRACT: HTTP transport for Test::Reporter |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=pod |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=head1 NAME |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
Test::Reporter::Transport::HTTPGateway - HTTP transport for Test::Reporter |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=head1 VERSION |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
version 1.59 |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head1 SYNOPSIS |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
my $report = Test::Reporter->new( |
69
|
|
|
|
|
|
|
transport => 'HTTPGateway', |
70
|
|
|
|
|
|
|
transport_args => [ $url, $key ], |
71
|
|
|
|
|
|
|
); |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=head1 DESCRIPTION |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
This module transmits a Test::Reporter report via HTTP to a |
76
|
|
|
|
|
|
|
L server (or something with an equivalent API). |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=head1 USAGE |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
See L and L for general usage |
81
|
|
|
|
|
|
|
information. |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=head2 Transport Arguments |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
$report->transport_args( $url, $key ); |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
This transport class accepts two positional arguments. The first is required |
88
|
|
|
|
|
|
|
and specifies the URL for the HTTPGateway server. The second argument |
89
|
|
|
|
|
|
|
specifies an API key to transmit to the gatway. It is optional for the |
90
|
|
|
|
|
|
|
transport class, but may be required by particular gateway servers. |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=head1 METHODS |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
These methods are only for internal use by Test::Reporter. |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=head2 new |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
my $sender = Test::Reporter::Transport::HTTPGateway->new( |
99
|
|
|
|
|
|
|
@args |
100
|
|
|
|
|
|
|
); |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
The C method is the object constructor. |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=head2 send |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
$sender->send( $report ); |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
The C method transmits the report. |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=head1 AUTHORS |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=over 4 |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=item * |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
Adam J. Foxson |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=item * |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
David Golden |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=item * |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
Kirrily "Skud" Robert |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
=item * |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
Ricardo Signes |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=item * |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
Richard Soderberg |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=item * |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
Kurt Starsinic |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
=back |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
This software is copyright (c) 2011 by Authors and Contributors. |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
145
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
=cut |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
__END__ |