PATCH: allow rt command to sort multiple object IDs/Names without warnings

Patch is against 3.6.0 rt command.

*** /root/rt-3.6.0.orig 2006-06-15 11:57:07.000000000 -0700
— /tmp/rt 2006-06-27 17:02:16.541296520 -0700
*** 1339,1345 ****
}

  @elts{@elts}=();

! return sort {$a<=>$b} keys %elts;
}

sub get_type_argument {
— 1339,1360 ----
}

  @elts{@elts}=();

! return sort {
! if ($a =~ /^\d+$/) { # $a is numeric ID …
! if ($b =~ /^\d+$/) { # … and $b is a numeric
ID,
! $a<=>$b; # return digit
comparison result
! }
! else { # $a is a numeric
ID, $b is an object name …
! -1; # order $a before
$b
! }
! }
! elsif ($b =~ /^\d+$/) { # $a is object name, $b is
numeric ID …
! 1; # order $b
before $a
! }
! else { # $a and $b are
object names …
! $a cmp $b; # order by string
value
! }
! } keys %elts;
}

sub get_type_argument {

Please, resubmit your patches as attachments and in unified diff format.On 6/28/06, Philip Kime pkime@shopzilla.com wrote:

Patch is against 3.6.0 rt command.

*** /root/rt-3.6.0.orig 2006-06-15 11:57:07.000000000 -0700
— /tmp/rt 2006-06-27 17:02:16.541296520 -0700


*** 1339,1345 ****
}

  @elts{@elts}=();

! return sort {$a<=>$b} keys %elts;
}

sub get_type_argument {
— 1339,1360 ----
}

  @elts{@elts}=();

! return sort {
! if ($a =~ /^\d+$/) { # $a is numeric ID …
! if ($b =~ /^\d+$/) { # … and $b is a numeric
ID,
! $a<=>$b; # return digit
comparison result
! }
! else { # $a is a numeric
ID, $b is an object name …
! -1; # order $a before
$b
! }
! }
! elsif ($b =~ /^\d+$/) { # $a is object name, $b is
numeric ID …
! 1; # order $b
before $a
! }
! else { # $a and $b are
object names …
! $a cmp $b; # order by string
value
! }
! } keys %elts;
}

sub get_type_argument {


List info: http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-devel

Best Practical is hiring! Come hack Perl for us: http://bestpractical.com/about/jobs.html

Best regards, Ruslan.

Apologies, I’ll do that now.

PKFrom: Ruslan Zakirov [mailto:ruslan.zakirov@gmail.com]
Sent: 27 June 2006 18:10
To: Philip Kime
Cc: Kevin Riggle; rt-devel@lists.bestpractical.com
Subject: Re: [Rt-devel] PATCH: allow rt command to sort multiple object
IDs/Names without warnings

Please, resubmit your patches as attachments and in unified diff format.

Patch is against 3.6.0 rt command.

*** /root/rt-3.6.0.orig 2006-06-15 11:57:07.000000000 -0700
— /tmp/rt 2006-06-27 17:02:16.541296520 -0700


*** 1339,1345 ****
}

  @elts{@elts}=();

! return sort {$a<=>$b} keys %elts;
}

sub get_type_argument {
— 1339,1360 ----
}

  @elts{@elts}=();

! return sort {
! if ($a =~ /^\d+$/) { # $a is numeric ID …
! if ($b =~ /^\d+$/) { # … and $b is a numeric
ID,
! $a<=>$b; # return digit
comparison result
! }
! else { # $a is a numeric
ID, $b is an object name …
! -1; # order $a
before
$b
! }
! }
! elsif ($b =~ /^\d+$/) { # $a is object name, $b
is
numeric ID …
! 1; # order $b
before $a
! }
! else { # $a and $b are
object names …
! $a cmp $b; # order by string
value
! }
! } keys %elts;
}

sub get_type_argument {


List info:
http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-devel

Best Practical is hiring! Come hack Perl for us:
http://bestpractical.com/about/jobs.html

Best regards, Ruslan.