]> iEval git - gruntmaster-daemon.git/blame - lib/Gruntmaster/SendResults.pm
Add javascript
[gruntmaster-daemon.git] / lib / Gruntmaster / SendResults.pm
CommitLineData
f58c979a
A
1package Gruntmaster::SendResults;
2
3use 5.014000;
4use strict;
5use warnings;
6use parent qw/Exporter/;
7
8use HTTP::Request;
9use JSON qw/encode_json decode_json/;
10use LWP::UserAgent;
11
12our $VERSION = '5999.000_005';
13our @EXPORT_OK = qw/send_results_request/;
14
15sub send_results_request {
16 my ($job_id, $result, $result_text) = @_;
17
18 my $url = $ENV{REMOTE_ADDRESS};
19 my $header = [
20 'Content-Type' => 'application/json'
21 ];
22 my $data = {
23 gm_id => $job_id,
24 result => $result,
25 result_text => $result_text
26 };
27
28 my $encoded_data = encode_json($data);
29 my $request = HTTP::Request->new(POST => $url, $header, $encoded_data);
30 my $ua = LWP::UserAgent->new();
31 my $response = $ua->request($request);
32
33 return $response;
34}
35
361;
This page took 0.025899 seconds and 5 git commands to generate.