regular expression variables under debugger

D

David Squire

Peter said:
So there is an even simpler (Look Ma! No TreeBuilder!) script to test
this:

----- test_without_TreeBuilder ---------------------------------
#!/usr/local/bin/perl

use strict;
use warnings;

my $str = 'Yahoo! U.S. News';
utf8::upgrade($str);
dumpstr($str);
($str =~ /(.*)news/i) or warn "No match!\n";
my $testPart = $1;
my $testWhole = $&;

my $breakpoint = 3;
print "testPart: <$testPart>, testWhole: <$testWhole>\n";

sub dumpstr {
my ($s) = @_;
print utf8::is_utf8($s) ? "char" : "byte", " string: ";
for (split(//, $s)) {
printf("%#x %s ", ord($_), /[[:print:]]/ ? $_ : '.');
}
print "\n";
}

Interesting. This gives different, but still unexpected behaviour for me
when run under the debugger (no problems when run with out it):

---- Start transcript ----

~/tmp (davids : dms54)
Aug 27 - 17:26 % perl -d test_without_TreeBuilder.pl

Loading DB routines from perl5db.pl version 1.28
Editor support available.

Enter h or `h h' for help, or `man perldebug' for more help.

main::(test_without_TreeBuilder.pl:6):
6: my $str = 'Yahoo! U.S. News';
DB<1> n

main::(test_without_TreeBuilder.pl:7):
7: utf8::upgrade($str);
DB<1> n

main::(test_without_TreeBuilder.pl:8):
8: dumpstr($str);
DB<1> n

char string: 0x59 Y 0x61 a 0x68 h 0x6f o 0x6f o 0x21 ! 0x20
0x4e N 0x65 e 0x77 w 0x73 s 0x3a : 0x20 0x55 U 0x2e . 0x53 S
0x2e . 0x20 0x4e N 0x65 e 0x77 w 0x73 s
main::(test_without_TreeBuilder.pl:9):
9: ($str =~ /(.*)news/i) or warn "No match!\n";
DB<1> n

---- End transcript ----


It never returned from that state (well, not yet :), and it's been going
for ~3 minutes). top shows that perl is running and taking up about
30-40% of my CPU, but is not growing in size.

I always have the DarwinPorts version of perl installed, which is:

----

~/tmp (davids : dms54)
Aug 27 - 17:30 % /opt/local/bin/perl -v

This is perl, v5.8.8 built for darwin-2level

----

With this version, there is no error running test_without_TreeBuilder.pl
under the debugger. The out-of-the-box Mac OS X perl is:

----

~/tmp (davids : dms54)
Aug 27 - 17:30 % perl -v

This is perl, v5.8.6 built for darwin-thread-multi-2level
(with 2 registered patches, see perl -V for more detail)

----

So I guess this is a problem that either went away in 5.8.8, or is
related to multithreading.


DS
 
W

wlcna

David Squire said:
Interesting. This gives different, but still unexpected behaviour for
me when run under the debugger (no problems when run with out it):
...

EXTREMELY INTERESTING. So I guess my "lightning" and someone else's
"acorn" have been eliminated as explanations. But still looks like an
issue hopefully entirely resolved by latest version.

FYI, as reported previously I tried this under 5.8.7 under Windows and
did not see the problem but right now I also just reinstalled the
universe from source under Linux and didn't see the problem there
either. Hopefully that's the status, but I'm keeping my eye on it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,143
Latest member
DewittMill
Top