Question
Not quite sure where to post this because it's a bug, but there's no bug reporting area in
Plugins.
TablePlugin has a bug in the getTypes() routine that causes columns with negative numbers to be sorted using cmp instead of <=>.
Where should I post this bug to?
BugReport didn't seem to have an appropriate way to report this and
SamHasler on irc noted that, while
ProposedBugReports can deal with this, that people might prefer to have bugs for plugins kept in
Plugins.
Environment
--
TravisCampbell - 10 Jan 2005
Answer
Here's a unified diff that fixes the sorting issue. It changes the regex used for finding a number so that if the number is immediately preceeded by a minus, then getTypes() returns the correct value.
--- /tmp/TablePlugin.pm Mon Jan 10 16:42:20 2005
+++ TablePlugin.pm Mon Jan 10 16:13:46 2005
@@ -275,7 +275,7 @@
$year += 1900 if( length( $year ) == 2 && $year > 80 );
$year += 2000 if( length( $year ) == 2 );
$date = timegm( 0, 0, 0, $1, $mon2num{$2}, $year - 1900 );
- } elsif ( $text =~ /^\s*[0-9]+(\.[0-9]+)?\s*$/ ) {
+ } elsif ( $text =~ /^\s*-?[0-9]+(\.[0-9]+)?\s*$/ ) {
$num = $text;
}
Original table:
| header |
| 1 |
| 0 |
| 5 |
| -2 |
| -500 |
| -499 |
| -501 |
| -10 |
| 100 |
Example of the table
without the patch:
| header |
| -10 |
| -2 |
| -499 |
| -500 |
| -501 |
| 0 |
| 1 |
| 100 |
| 5 |
Example of the table
with the patch:
| header |
| -501 |
| -500 |
| -499 |
| -10 |
| -2 |
| 0 |
| 1 |
| 5 |
| 100 |
--
TravisCampbell - 10 Jan 2005
Thanks Travis. We do not yet have a bug tracking app in the
Plugins web. Defects are currently reported in the Dev topic. I added a link to this topic in
TablePluginDev.
--
PeterThoeny - 11 Jan 2005
Ok, I'll keep this in mind. Thanks!
--
TravisCampbell - 18 Jan 2005
Thanks for providing this patch, Travis.
--
WillNorris - 18 Jan 2005