<% $json %> <%once> use JSON::XS; <%args> $id => undef $name => undef <%init> warn Dumper \%ARGS if $DEBUG; my %result; if ( $id && $id =~ /^\d+$/ || $name && length( Encode::decode('utf-8', $name) ) > 1 ) { my @tags = $keeper->get_documents( class => 'tag::Tag', status => 1, $id ? ( id => [$id] ) : (name => '%'.$name.'%'), ilike => 1, order_by => 'name', ); $result{success} = 1; if ( @tags ) { $result{html} = Encode::decode('utf-8', $m->scomp('/contenido/tag/components/block_tag_list.msn', tags => \@tags) ); } else { $result{html} = ''; } } else { $result{error} = Encode::decode('utf-8', 'Недостаточные параметры для поиска тега'); } my $json = encode_json \%result;