37 |
sub lookup { |
sub lookup { |
38 |
my $self = shift; |
my $self = shift; |
39 |
my $field = shift; |
my $field = shift; |
40 |
|
my $table = shift; |
41 |
|
my $where = ''; |
42 |
|
|
43 |
|
if ( ! $table ) { |
44 |
|
$table = "archive_$field"; |
45 |
|
$where = " and lang = 'hr'"; |
46 |
|
} |
47 |
|
|
48 |
my $sql = qq{ |
my $sql = qq{ |
49 |
SELECT $field |
SELECT $field |
50 |
FROM archive_$field |
FROM $table |
51 |
WHERE eprintid = $id |
WHERE eprintid = $id $where |
52 |
}; |
}; |
53 |
warn "# sql: $sql\n" if $debug; |
warn "# sql: $sql\n" if $debug; |
54 |
my @results = map { _x( $_->{$field} ) } @{ $dbh->selectall_arrayref($sql, { Slice => {} }) }; |
my @results = map { _x( $_->{$field} ) } @{ $dbh->selectall_arrayref($sql, { Slice => {} }) }; |
67 |
|
|
68 |
sub slogovi { |
sub slogovi { |
69 |
my $text = shift; |
my $text = shift; |
70 |
my @s; |
|
71 |
|
my $count = 2; |
72 |
|
my $out = ''; |
73 |
|
|
74 |
foreach my $w ( split(/\W*\s+\W*/, $text ) ) { |
foreach my $w ( split(/\W*\s+\W*/, $text ) ) { |
75 |
my $pos = 0; |
warn "w: $w\n" if $debug; |
76 |
|
my @s; |
77 |
while ( $w =~ s/^([^aeiou]*[aeiou])//i ) { |
while ( $w =~ s/^([^aeiou]*[aeiou])//i ) { |
78 |
push @s, $pos++ . $1; |
push @s, $1; |
79 |
} |
} |
80 |
push @s, $pos . $w if $w; |
push @s, $w if $w; |
81 |
warn "slogovi = ", dump( @s ), $/ if $debug; |
warn "slogovi = ", dump( @s ), $/ if $debug; |
82 |
|
foreach my $p ( 0 .. ( $#s - $count + 1 ) ) { |
83 |
|
map { $out .= $s[ $p + $_ ] } 0 .. $count - 1; |
84 |
|
$out .= ' '; |
85 |
|
} |
86 |
} |
} |
87 |
return @s; |
warn "$out\n" if $debug; |
88 |
|
return $out; |
89 |
} |
} |
90 |
|
|
91 |
1; |
1; |