hmonroe has asked for the wisdom of the Perl Monks concerning the following question:

Why does the following run with no problem but cause a SEGV in debug mode (Tk::Text seems to have an issue with regexp searches)? We want to be able to use the debugger to clean up a perl Tk editor with 20000 lines of code. This tool called Guiguts is used to produce thousands of eBooks for Project Gutenberg each year. First priority is to work around the SEGV; second is to fix the SEGV. Thanks to those who suggested in response to an earlier post (http://www.perlmonks.org/?node_id=950595) that I use Devel::ptkdb and Devel::ebug but I really want IDE integration.
#!/usr/bin/env perl use Tk; $topWin = MainWindow->new(); my $text = $topWin->Text(); $text->insert("end", "Type text into this window"); print $text->search("-exact", 'e', '1.0', 'end')."\n"; print $text->search("-regexp", 'e', '1.0', 'end')."\n"; $text->pack(); MainLoop();

Replies are listed 'Best First'.
Re: Tk Text regex crashes debugger
by GrandFather (Saint) on Jan 31, 2012 at 23:54 UTC

    This is probably of no great help in resolving your problem, but it may help to define the parameters of the issue when you submit your bug report.

    Run in debug mode your script outputs 1.3 from the first print, hangs for a few tens of seconds, then exits without generating output from the second print or entering Mainloop on Windows using Perl 5.10.1 and Tk 804.029.

    Run normally the script runs as expected under Windows.

    True laziness is hard work
Re: Tk Text regex crashes debugger
by thundergnat (Deacon) on Feb 01, 2012 at 15:18 UTC

    Some further data points. It also SEGVs at the same point when running in the debugger under Linux with Perl 5.12.4 and Tk 804.029 and under Linux with Perl 5.14.2 and Tk 804.030.

    Even more trimmed down example:

    use Tk; my $m = MainWindow->new; my $t = $m->Text->pack; $t->search('-regexp', '', '1.0', 'end'); # debugger crash