G
Gunnar Hjalmarsson
In an app where a user may provide a Perl regular expression I want to
validate the regex before it's applied. Currently I'm doing something like:
{
local $SIG{__WARN__} = sub { die $_[0] };
eval { $regex = qr($regex) };
die $@ if $@;
}
In other words I rely on Perl's ability to catch errors, where also
warnings are treated as errors.
Are there other appropriate checks that could be done?
validate the regex before it's applied. Currently I'm doing something like:
{
local $SIG{__WARN__} = sub { die $_[0] };
eval { $regex = qr($regex) };
die $@ if $@;
}
In other words I rely on Perl's ability to catch errors, where also
warnings are treated as errors.
Are there other appropriate checks that could be done?