Vaclav Barta
2006-05-01 06:06:44 UTC
Hi,
seems rather quiet in here - anybody listening? Anyway, I've written an XS
module for perl 5.8.7 (Regexp::Compare, on CPAN) using regular expressions.
It compiles them (from caller-supplied strings) with pregcomp, and I gather
the compiled regexps should be released with pregfree. That works, but I'm
concerned about invalid values. For some inputs (i.e. '[a'), pregcomp croaks
and control returns to the perl caller, which is fine, except my function
compiles *two* regexps and when the second one croaks, it doesn't get a
chance to release the first... Is there some equivalent of try/catch in XS,
or a way to register the compiled regexp as a Perl object, to be released
automatically when not needed?
Bye
Vasek
seems rather quiet in here - anybody listening? Anyway, I've written an XS
module for perl 5.8.7 (Regexp::Compare, on CPAN) using regular expressions.
It compiles them (from caller-supplied strings) with pregcomp, and I gather
the compiled regexps should be released with pregfree. That works, but I'm
concerned about invalid values. For some inputs (i.e. '[a'), pregcomp croaks
and control returns to the perl caller, which is fine, except my function
compiles *two* regexps and when the second one croaks, it doesn't get a
chance to release the first... Is there some equivalent of try/catch in XS,
or a way to register the compiled regexp as a Perl object, to be released
automatically when not needed?
Bye
Vasek