/usr/share/perl5/MARC/Spec/Comparisonstring.pm is in libmarc-spec-perl 2.0.3-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 | package MARC::Spec::Comparisonstring;
use Carp qw(croak);
use Moo;
use namespace::clean;
our $VERSION = '2.0.3';
has raw => (
is => 'rwp',
required => 1
);
has comparable => (
is => 'rwp'
);
sub BUILDARGS {
my ( $class, @args ) = @_;
unshift @args, "raw" if @args % 2 == 1;
return { @args };
}
sub BUILD {
my ($self, $args) = @_;
# char of list ${}!=~?|\s must be escaped if not at index 0*
croak "MARCspec Comparisonstring exception. Unescaped character detected. Tried to parse: ".$self->raw
unless($self->raw =~ /^(.(?:[^\$\{\}\!\=\~\?\|\s]|(?<=\\\\)[\$\{\}\!\=\~\?\|])*)$/s);
my $comparable = $self->raw;
my $replace = ' ';
$comparable =~ s{\\s}{$replace}g;
$self->_set_comparable($comparable);
return;
}
sub to_string {
my ($self) = @_;
my $string = '\\'.$self->raw;
return $string;
}
1;
__END__
=encoding utf-8
=head1 NAME
MARC::Spec::Comparisonstring - comparison string specification
=head1 SYNOPSIS
use MARC::Spec;
my $ms = MARC::Spec->new('245{$a~\marc});
say ref $ms->field->subspecs->[0]->rightSubTerm; # MARC::Spec::Comparisonstring
=head1 DESCRIPTION
MARC::Spec::Comparisonstring is the comparison string specification of a L<MARC::Spec|MARC::Spec>.
See L<MARCspec - A common MARC record path language|http://marcspec.github.io/MARCspec/> for further
details on the syntax.
=head1 METHODS
=head2 new
Create a new MARC::Spec::Comparisonstring instance.
=head2 to_string
Returns the spec as a string.
=head1 ATTRIBUTES
=head2 raw
Obligatory. The raw comparison string with escaped characters.
=head2 comparable
Obligatory. The comparison string without the escaping "\".
=head1 AUTHOR
Carsten Klee C<< <klee at cpan.org> >>
=head1 CONTRIBUTORS
=over
=item * Johann Rolschewski, C<< <jorol at cpan> >>
=back
=head1 COPYRIGHT AND LICENSE
This software is copyright (c) 2016 by Carsten Klee.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
=head1 BUGS
Please report any bugs to L<https://github.com/MARCspec/MARC-Spec/issues|https://github.com/MARCspec/MARC-Spec/issues>
=head1 SEE ALSO
=over
=item * L<MARC::Spec|MARC::Spec>
=item * L<MARC::Spec::Field|MARC::Spec::Field>
=item * L<MARC::Spec::Subfield|MARC::Spec::Subfield>
=item * L<MARC::Spec::Indicator|MARC::Spec::Indicator>
=item * L<MARC::Spec::Subspec|MARC::Spec::Subspec>
=item * L<MARC::Spec::Structure|MARC::Spec::Structure>
=item * L<MARC::Spec::Parser|MARC::Spec::Parser>
=back
=cut
|