NAME
Tags::Utils - Utils module for Tags.
SYNOPSIS
use Tags::Utils qw(encode_newline encode_attr_entities encode_char_entities);
my $string_with_encoded_newline = encode_newline("foo\nbar");
my $string_with_encoded_attr_entities = encode_attr_entities('<data & "data"');
my $string_with_encoded_char_entities = encode_char_entities('<data & data');
SUBROUTINES
encode_newline($string)
-
Encode newline to '\n' string.
encode_attr_entities($data_r)
-
Decode all '&..;' strings. Encode '<', '&' and '"' entities to '&..;' string. $data_r can be: - Scalar. Returns encoded scalar. - Scalar reference. Returns undef. - Array reference of scalars. Returns undef.
encode_char_entities($data_r)
-
Decode all '&..;' strings. Encode '<', '&' and 'non-break space' entities to '&..;' string. $data_r can be: - Scalar. Returns encoded scalar. - Scalar reference. Returns undef. - Array reference of scalars. Returns undef.
ERRORS
encode_attr_entities():
Reference '%s' doesn't supported.
encode_char_entities():
Reference '%s' doesn't supported.
EXAMPLE1
use strict;
use warnings;
use Tags::Utils qw(encode_newline);
# Input text.
my $text = <<'END';
foo
bar
END
# Encode newlines.
my $out = encode_newline($text);
# Print out.
print $out."\n";
# Output:
# foo\nbar\n
EXAMPLE2
use strict;
use warnings;
use Dumpvalue;
use Tags::Utils qw(encode_attr_entities);
# Input data.
my @data = ('&', '<', '"');
# Encode.
encode_attr_entities(\@data);
# Dump out.
my $dump = Dumpvalue->new;
$dump->dumpValues(\@data);
# Output:
# 0 ARRAY(0x8b8f428)
# 0 '&'
# 1 '<'
# 2 '"'
DEPENDENCIES
Error::Pure, HTML::Entities, Readonly.
SEE ALSO
- Task::Tags
-
Install the Tags modules.
REPOSITORY
https://github.com/michal-josef-spacek/Tags
AUTHOR
Michal Josef Špaček mailto:skim@cpan.org
LICENSE AND COPYRIGHT
© 2005-2024 Michal Josef Špaček
BSD 2-Clause License
VERSION
0.16