File: report-bug-to-cpan.pl

package info (click to toggle)
librt-client-rest-perl 1%3A0.56-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 568 kB
  • sloc: perl: 4,205; makefile: 9
file content (62 lines) | stat: -rw-r--r-- 1,359 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/usr/bin/perl
#
# This scripts reports a new RT::Client::REST bug to CPAN.

use strict;
use warnings;

use Error qw(:try);
use RT::Client::REST;
use RT::Client::REST::Ticket;
use Term::ReadKey;

my $rt = RT::Client::REST->new(server => 'http://rt.cpan.org');

my $dist = 'RT-Client-REST';    # This is the name of the queue.

my ($username, $password);

print "RT Username: ";
chomp($username = <>);

print "RT Password: ";
ReadMode 2;
chomp($password = <>);
ReadMode 0;

$| = 1;

print "\nAuthenticating...";

try {
    $rt->login(username => $username, password => $password);
} catch Exception::Class::Base with {
    my $e = shift;
    die ref($e), ": ", $e->message || $e->description, "\n";
};

print "\nShort description of the problem (one line):\n";
chomp(my $subject = <>);

print "Long description (lone period or Ctrl-D to end):\n";
my $description = '';
while (<>) {
    chomp;
    last if '.' eq $_;
    $description = $description . "\n" . $_;
}

my $ticket;
try {
    $ticket = RT::Client::REST::Ticket->new(
        rt => $rt,
        subject => $subject,
        queue => $dist,
    )->store;
    $ticket->correspond(message => $description);
} catch Exception::Class::Base with {
    my $e = shift;
    die ref($e), ": ", $e->message || $e->description, "\n";
};

print "Created ticket ", $ticket->id, " in queue ", $ticket->queue, "\n";