line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package MARC::Spec::Comparisonstring; |
2
|
|
|
|
|
|
|
|
3
|
14
|
|
|
14
|
|
25312
|
use Carp qw(croak); |
|
14
|
|
|
|
|
36
|
|
|
14
|
|
|
|
|
927
|
|
4
|
14
|
|
|
14
|
|
696
|
use Moo; |
|
14
|
|
|
|
|
15731
|
|
|
14
|
|
|
|
|
88
|
|
5
|
14
|
|
|
14
|
|
7708
|
use namespace::clean; |
|
14
|
|
|
|
|
14704
|
|
|
14
|
|
|
|
|
92
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '1.0.0'; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
has raw => ( |
10
|
|
|
|
|
|
|
is => 'rwp', |
11
|
|
|
|
|
|
|
required => 1 |
12
|
|
|
|
|
|
|
); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
has comparable => ( |
15
|
|
|
|
|
|
|
is => 'rwp' |
16
|
|
|
|
|
|
|
); |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub BUILDARGS { |
19
|
87
|
|
|
87
|
0
|
12589
|
my ( $class, @args ) = @_; |
20
|
87
|
50
|
|
|
|
319
|
unshift @args, "raw" if @args % 2 == 1; |
21
|
87
|
|
|
|
|
1337
|
return { @args }; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub BUILD { |
25
|
87
|
|
|
87
|
0
|
1164
|
my ($self, $args) = @_; |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
# char of list ${}!=~?|\s must be escaped if not at index 0* |
28
|
87
|
100
|
|
|
|
436
|
croak "MARCspec Comparisonstring exception. Unescaped character detected. Tried to parse: ".$self->raw |
29
|
|
|
|
|
|
|
unless($self->raw =~ /^(.(?:[^\$\{\}\!\=\~\?\|\s]|(?<=\\\\)[\$\{\}\!\=\~\?\|])*)$/s); |
30
|
|
|
|
|
|
|
|
31
|
86
|
|
|
|
|
200
|
my $comparable = $self->raw; |
32
|
86
|
|
|
|
|
139
|
my $replace = ' '; |
33
|
86
|
|
|
|
|
145
|
$comparable =~ s{\\s}{$replace}g; |
34
|
86
|
|
|
|
|
264
|
$self->_set_comparable($comparable); |
35
|
86
|
|
|
|
|
1436
|
return; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub to_string { |
39
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
40
|
0
|
|
|
|
|
|
my $string = '\\'.$self->raw; |
41
|
0
|
|
|
|
|
|
return $string; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
1; |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
__END__ |