34e00ca5f0
Move function to rt-helper.pl that might be used in other Perl scripts.
31 lines
911 B
Perl
31 lines
911 B
Perl
# -*- Perl -*-
|
|
# Copyright © 2018, Bradley M. Kuhn
|
|
# License: AGPL-3.0-or-later
|
|
###############################################################################
|
|
sub Outreachy_FindUniqueTicket(@) {
|
|
my @searchTerms = @_;
|
|
open(my $rtLsFH, "-|", "$RT_CMD", "ls", "-i", 'Queue = outreachy-interns ' .
|
|
"AND Subject LIKE '" . $ROUND . "' AND" .
|
|
join(" AND ", @searchTerms));
|
|
my $ticketSpec;
|
|
while (my $lsLine = <$rtLsFH>) {
|
|
chomp $lsLine;
|
|
if ($lsLine =~ /ticket/) {
|
|
if (defined $ticketSpec) {
|
|
$ticketSpec = undef;
|
|
last;
|
|
}
|
|
$ticketSpec = $lsLine;
|
|
}
|
|
}
|
|
close $rtLsFH;
|
|
return $ticketSpec;
|
|
}
|
|
###############################################################################
|
|
1;
|
|
###############################################################################
|
|
#
|
|
# Local variables:
|
|
# compile-command: "perl -c rt-helper.pl"
|
|
# perl-indent-level: 2
|
|
# End:
|