line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Regexp::DefaultFlags; |
2
|
|
|
|
|
|
|
$Regexp::DefaultFlags::VERSION = '0.01'; |
3
|
|
|
|
|
|
|
|
4
|
1
|
|
|
1
|
|
9892
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
31
|
|
5
|
1
|
|
|
1
|
|
1591
|
use overload; |
|
1
|
|
|
|
|
1033
|
|
|
1
|
|
|
|
|
7
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
sub import { |
8
|
3
|
|
|
3
|
|
501
|
my $class = shift; # Ignore package name |
9
|
3
|
100
|
|
|
|
13
|
my $flags = @_ ? join(' ', @_) : 'xms'; # Get flags (or defaults) |
10
|
3
|
|
|
|
|
14
|
$flags =~ s{[\s/]+}{}g; # Remove decorations |
11
|
3
|
100
|
|
|
|
13
|
if ($flags =~ m/([^imsx]+)/) { # Detect invalid flags |
12
|
1
|
|
|
|
|
86
|
require Carp; |
13
|
1
|
|
|
|
|
197
|
Carp::croak("Unknown regular expression flag: $1"); |
14
|
|
|
|
|
|
|
} |
15
|
|
|
|
|
|
|
overload::constant( # Prefilter constants... |
16
|
|
|
|
|
|
|
qr => sub { # For every regex constant: |
17
|
4
|
|
|
4
|
|
1906
|
return "(?$flags:$_[1])"; # Flag via (?mix:...) syntax |
18
|
|
|
|
|
|
|
}, |
19
|
2
|
|
|
|
|
11
|
); |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
1; |
23
|
|
|
|
|
|
|
__END__ |