Subject: | Tk::FBox bug report |
Date: | Thu, 20 Nov 2008 00:27:25 +0500 |
To: | bug-Tk [...] rt.cpan.org |
From: | Alexander Krasnorutsky <krasnoroot [...] mail.ru> |
Message body is not shown because sender requested not to inline it.
Hello!
I think that there is an error in the Tk::FBox module (VERSION 4.019; Tk
804.028).
1) If user enters expression like '?????' he will see this error
message:
XS_Tk__Callback_Call error:Nested quantifiers in regex;marked by
<-- HERE in m/^??? <-- HERE ??$/
at /usr/lib/perl5/site_perl/5.8.6/i386-linux-thread-multi/Tk/FBox.pm
line 1041.
2) If filename contains a newline character (it is possible on
ext2/ext3) then this file will be invisible in the icon list.
3) Multiple globs work wrong (i.e., filenames matching /^regex/
or /regex/ or /regex$/ will be shown but not only ones which
match /^regex$/).
I think (IMHO) that 1),2),3) are because of an error at "_rx_to_glob"
subroutine.
4) "perlvar" says about $] :
'When testing the variable, to steer clear of floating point
inaccuracies you might want to prefer the inequality tests "<"
and ">" to the tests containing equivalence: "<=", "==", and ">="'.
I have written a patch:
# patchFBox_BasicGlob.diff; compatible with tkfbox.tcl
========= cut here =========
454c454
< next if !-d $f && $f !~ m!$flt!;
---
Show quoted text
> next if !-d $f && $f !~ m!$flt!s;
560c560
< if (!-d $path && $path !~ /\..+$/ && defined $defaultext) {
---
Show quoted text> if (!-d $path && $path !~ /\..+$/s && defined $defaultext) {
995c995
< } elsif ($dir =~ m|^~/(.*)|) {
---
Show quoted text> } elsif ($dir =~ m|^~/(.*)|s) {
997c997
< } elsif ($dir =~ m|^~([^/]+(.*))|) {
---
Show quoted text> } elsif ($dir =~ m|^~([^/]+(.*))|s) {
1036,1041c1036,1040
< $arg = join('|', split(' ', $arg));
< $arg =~ s!([\.\+])!\\$1!g;
< $arg =~ s!\*!.*!g;
< $arg = "^" . $arg . "\$";
< if ($] >= 5.005) {
< $arg = qr/$arg/;
---
Show quoted text> $arg =~ s!([.+^()|\@\${}\[\]\\])!\\$1!g;
> $arg = join('|', map {"^$_\\z"} split(' ', $arg));
> $arg =~ s!\*!.*!g;$arg =~ s!\?!.!g;
> if ($] > 5.0049) {
> $arg = qr/$arg/s;
========= cut here =========
.
This patch is also available as an attachment to this message.
It also would be nice to provide a method (for programmers who use this
module) to specify custom encodings for displaying filenames (not only
Latin-1).
Best regards
--
Alexander Krasnorutsky.