269 |
return $ret || undef; |
return $ret || undef; |
270 |
} |
} |
271 |
|
|
|
=head2 _sort_by_order |
|
|
|
|
|
Sort xml tags data structure accoding to C<order=""> attribute. |
|
|
|
|
|
=cut |
|
|
|
|
|
sub _sort_by_order { |
|
|
my $self = shift; |
|
|
|
|
|
my $va = $self->{'import_xml'}->{'indexer'}->{$a}->{'order'} || |
|
|
$self->{'import_xml'}->{'indexer'}->{$a}; |
|
|
my $vb = $self->{'import_xml'}->{'indexer'}->{$b}->{'order'} || |
|
|
$self->{'import_xml'}->{'indexer'}->{$b}; |
|
|
|
|
|
return $va <=> $vb; |
|
|
} |
|
|
|
|
|
=head2 _x |
|
|
|
|
|
Convert string from UTF-8 to code page defined in C<import_xml>. |
|
|
|
|
|
my $text = $webpac->_x('utf8 text'); |
|
|
|
|
|
Default application code page is C<ISO-8859-2>. You will probably want to |
|
|
change that when creating new instance of object based on this one. |
|
|
|
|
|
=cut |
|
|
|
|
|
sub _x { |
|
|
my $self = shift; |
|
|
my $utf8 = shift || return; |
|
|
|
|
|
# create UTF-8 convertor for import_xml files |
|
|
$self->{'utf2cp'} ||= Text::Iconv->new('UTF-8' ,$self->{'code_page'} || 'ISO-8859-2'); |
|
|
|
|
|
return $self->{'utf2cp'}->convert($utf8) || |
|
|
$self->_get_logger()->logwarn("can't convert '$utf8'"); |
|
|
} |
|
|
|
|
272 |
=head2 _init_logger |
=head2 _init_logger |
273 |
|
|
274 |
This function will init C<Log::Log4perl> using provided configuration file. |
This function will init C<Log::Log4perl> using provided configuration file. |