16 |
marc_template |
marc_template |
17 |
|
|
18 |
rec1 rec2 rec |
rec1 rec2 rec |
19 |
frec |
frec frec_eq frec_ne |
20 |
regex prefix suffix surround |
regex prefix suffix surround |
21 |
first lookup join_with |
first lookup join_with |
22 |
save_into_lookup |
save_into_lookup |
48 |
|
|
49 |
=cut |
=cut |
50 |
|
|
51 |
our $VERSION = '0.33'; |
our $VERSION = '0.34'; |
52 |
|
|
53 |
=head1 SYNOPSIS |
=head1 SYNOPSIS |
54 |
|
|
1168 |
return shift @out; |
return shift @out; |
1169 |
} |
} |
1170 |
|
|
1171 |
|
=head2 frec_eq |
1172 |
|
|
1173 |
|
=head2 frec_ne |
1174 |
|
|
1175 |
|
Check if first values from two fields are same or different |
1176 |
|
|
1177 |
|
if ( frec_eq( 900 => 'a', 910 => 'c' ) ) { |
1178 |
|
# values are same |
1179 |
|
} else { |
1180 |
|
# values are different |
1181 |
|
} |
1182 |
|
|
1183 |
|
Strictly speaking C<frec_eq> and C<frec_ne> wouldn't be needed if you |
1184 |
|
could write something like: |
1185 |
|
|
1186 |
|
if ( frec( '900','a' ) eq frec( '910','c' ) ) { |
1187 |
|
# yada tada |
1188 |
|
} |
1189 |
|
|
1190 |
|
but you can't since our parser L<WebPAC::Parser> will remove all whitespaces |
1191 |
|
in order to parse text and create invalid function C<eqfrec>. |
1192 |
|
|
1193 |
|
=cut |
1194 |
|
|
1195 |
|
sub frec_eq { |
1196 |
|
my ( $f1,$sf1, $f2, $sf2 ) = @_; |
1197 |
|
return (rec( $f1, $sf1 ))[0] eq (rec( $f2, $sf2 ))[0]; |
1198 |
|
} |
1199 |
|
|
1200 |
|
sub frec_ne { |
1201 |
|
return ! frec_eq( @_ ); |
1202 |
|
} |
1203 |
|
|
1204 |
=head2 regex |
=head2 regex |
1205 |
|
|
1206 |
Apply regex to some or all values |
Apply regex to some or all values |