Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

schwern (1528)

schwern
  (email not shown publicly)
http://schwern.net/
AOL IM: MichaelSchwern (Add Buddy, Send Message)
Jabber: schwern@gmail.com

Schwern can destroy CPAN at his whim.

Journal of schwern (1528)

Saturday November 24, 2007
06:42 PM

rt.cpan.org, sort by severity

[ #34967 ]

It's always annoyed me that rt.cpan.org can no longer sort tickets by severity. This isn't such a big deal unless you have a lot of tickets, as I do. MakeMaker alone has over 90.

I found RT::Client::REST and hacked up their example to produce for me a list by severity. Yay! If one cared, you could encode the search results as JSON and make some sort of clever web interface with resortable columns.

#!/usr/bin/perl -w
 
use strict;
 
use Error qw(:try);
 
use RT::Client::REST;
 
my %Config = (
    server      => 'http://rt.cpan.org',
    username    => 'YOU',
    password    => 'wouldn't you like to know',
    queue       => 'Your-Module'
);
 
my $rt = RT::Client::REST->new(
    server  => $Config{server},
    timeout => 30
);
 
try {
    $rt->login( username => $Config{username}, password => $Config{password} );
}
catch Exception::Class::Base with {
    die "problem logging in: ", shift->message;
};
 
my @ids;
try {
    @ids = $rt->search(
        type    => 'ticket',
        query   => qq[
            (Status = 'new' or Status = 'open')
            and
            Queue = '$Config{queue}'
        ],
        orderby => 'CustomField.{Severity}'
    );
}
catch Exception::Class::Base with {
    die "search failed", shift->message;
};
 
for my $id (@ids) {
    my $ticket = $rt->show(type => 'ticket', id => $id);
    print "ID: $id\n";
    print "\tSubject: ", $ticket->{Subject}, "\n";
    print "\tSeverity: ", $ticket->{"CF-Severity"}, "\n";
}

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.