display('Parts',
lookup(
- regex( 's/^/dio-jzav:/', rec(900) )
+ prefix( 'dio-jzav:', rec(900) )
)
);
search('Parts',
lookup(
- regex( 's/^/id-dio-jzav:/', rec(900) )
+ prefix( 'id-dio-jzav:', rec(900) )
)
);
display('PartsEF',
lookup(
- regex( 's/^/naslov-efzg:001/', rec('001') )
+ prefix( 'naslov-efzg:001', rec('001') )
)
);
tag('Piece',
lookup(
- regex( 's/^/nazlov-efzg:/',
+ prefix( 'nazlov-efzg:',
first(
rec(463,1)
)
tag('PieceSubtitle',
lookup(
- regex( 's/^/podnazlov-efzg:/',
+ prefix( 'podnazlov-efzg:',
first(
rec(463,1)
)
set_rec set_lookup
get_ds clean_ds
tag search display
- rec1 rec2 rec regex first lookup join_with
+ rec1 rec2 rec
+ regex prefix
+ first lookup join_with
/;
use warnings;
=head1 VERSION
-Version 0.02
+Version 0.03
=cut
-our $VERSION = '0.02';
+our $VERSION = '0.03';
=head1 SYNOPSIS
my $out;
sub tag {
- my $name = shift or "tag needs name as first argument";
+ my $name = shift or die "tag needs name as first argument";
return unless (@_);
$out->{$name}->{tag} = $name;
$out->{$name}->{search} = \@_;
=cut
sub display {
- my $name = shift or "display needs name as first argument";
+ my $name = shift or die "display needs name as first argument";
return unless (@_);
$out->{$name}->{tag} = $name;
$out->{$name}->{display} = \@_;
=cut
sub search {
- my $name = shift or "search needs name as first argument";
+ my $name = shift or die "search needs name as first argument";
return unless (@_);
$out->{$name}->{tag} = $name;
$out->{$name}->{search} = \@_;
return @out;
}
+=head2 prefix
+
+Prefix all values with a string
+
+ @v = prefix( 'my_', @v );
+
+=cut
+
+sub prefix {
+ my $p = shift or die "prefix needs string as first argument";
+ return map { $p . $_ } @_;
+}
+
=head2 first
Return first element