in reply to Code critique XS function for extracting a blessed regex's pattern.
The problem is with your initial code. Bless expects a reference, and a "regex object" is just a string. If you pass a string to bless, it will force the string to become a reference, and that is why you get something that looks likeFoo=SCALAR(0x1acf020). However, if you pass bless a reference to the "regex object", then everything is fine. Observe:
my $qr=qr/^normal$/; my $bqr=bless \(qr/^blessed$/),"Foo"; print "Normal : $qr\n"; print "Blessed: $$bqr\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Code critique XS function for extracting a blessed regex's pattern.
by sauoq (Abbot) on Feb 05, 2003 at 22:14 UTC |