script/jenkins-notification-listener.pl untested

filter: Statementstmt 0.0% 0 / 31 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 6 Podpod n/a totaltotal 0.0% 0 / 39 CC 1 SCAR 6.9
CC
1
Cov
0%
BEGIN
2.0
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1 #!/usr/bin/env perl
2 use Net::Jenkins;
3 use Jenkins::NotificationListener;
4 use Getopt::Long;
5 use AnyEvent;
6 use JSON::XS;
7 use YAML;
8  
9 my $host = '127.0.0.1';
10 my $port = 8888;
11 my $debug;
12 my $result = GetOptions(
13 'host=s' => \$host,
14 'port=i' => \$port,
15 'd|debug' => \$debug,
16 );
17  
18 print "Listening at $host:$port...\n";
19 Jenkins::NotificationListener->new( host => $host , port => $port , on_notify => sub {
20 my $payload = shift; # Jenkins::Notification;
21  
22 if( $debug ) {
23 my $args = decode_json $payload->raw_json;
24 print "===== Payload Start =====\n";
25 print Dump $args;
26 }
27  
28  
29 print $payload->name , " #" , $payload->build->number, " : " , $payload->status
30 , " : " , $payload->phase
31 , " : " , $payload->url
32 , "\n";
33  
34 })->start;
35  
36  
37 AnyEvent->condvar->recv;