Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

sky (1411)

sky
  (email not shown publicly)

sky on IRC

Journal of sky (1411)

Thursday May 24, 2001
05:12 AM

Regex joy and a bug!

[ #203 ]
I just discovered that the regex engines variables are threadsafe. Rejoice eh?

my $foo = "bar";
$foo =~/(.)/;
iThread->create(sub { $foo =~/b(.)/; print "$1" })->join;
print "$1";

Corretclty prints ab.

However I found a BUG that is kind of explainable I guess:

my $foo = "bar";
$foo =~/(.)/;
iThread->create(sub { print "$1\n"; })->join;

SEGFAULTS with:

#0  0x8098ab9 in Perl_magic_get ()
#1  0x809803e in Perl_mg_get ()
#2  0x80a1138 in Perl_pp_concat ()
#3  0x80a0b51 in Perl_runops_standard ()
#4  0x8060458 in S_call_body ()
#5  0x805ffba in Perl_call_sv ()
#6  0x40185f6d in ithread_run ()

That is on the todo to document and then fix!

Artur