aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org>2016-03-11 17:18:01 +0200
committerSergey Poznyakoff <gray@gnu.org>2016-03-11 17:18:01 +0200
commitd6b266fc3bdcc7a612663be2c22ac147d3d01a74 (patch)
tree3c99282facd470ff9fe258d2c16ffd8986f8d275
parent57a4565ce5bce0a1f2ecb08a80781783e05105bc (diff)
downloadregexp-opt-d6b266fc3bdcc7a612663be2c22ac147d3d01a74.tar.gz
regexp-opt-d6b266fc3bdcc7a612663be2c22ac147d3d01a74.tar.bz2
Provide default regexp type.
-rw-r--r--lib/List/Regexp.pm6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/List/Regexp.pm b/lib/List/Regexp.pm
index 76e4a7f..a9bee17 100644
--- a/lib/List/Regexp.pm
+++ b/lib/List/Regexp.pm
@@ -393,16 +393,18 @@ Sergey Poznyakoff <gray@gnu.org>
=cut
sub regexp_opt {
- my $trans = \&trans_pcre;
+ my $trans;
my $opts;
my $conf;
$opts = shift if (ref($_[0]) eq 'HASH');
- if (defined($opts->{type})) {
+ if (exists($opts->{type})) {
croak "unsupported type: $opts->{type}"
unless exists $transtab{$opts->{type}};
$trans = $transtab{$opts->{type}};
+ } else {
+ $trans = $transtab{'pcre'};
}
my %h = map { $_, 1 } @_; # Make sure there are no duplicates

Return to:

Send suggestions and report system problems to the System administrator.