NAME
PYX::Utils - A perl module for PYX common utilities.
SYNOPSIS
my $decoded_text = decode($text);
my $encoded_text = encode($text);
my $decoded_text = entity_decode($text);
my $encoded_text = entity_encode($text);
SUBROUTINES
"decode($text)"
Decode characters.
Currently decode newline to '\n'.
Returns decoded text.
"encode($text)"
Encode characters.
Currently encode '\n' to newline.
Returns encoded text.
"entity_decode($text)"
Decode entities.
- '<' => '<'
- '&' => '&'
- '"' => '"'
Returns decoded text.
"entity_encode($text)"
Encode some chars for HTML/XML/SGML.
Currenctly encode these characters:
- '<' => '<'
- '&' => '&'
- '"' => '"'
Returns encoded text.
EXAMPLE1
# Pragmas.
use strict;
use warnings;
# Modules.
use PYX::Utils qw(decode);
# Text.
my $text = "foo\nbar";
# Decode.
my $decoded_text = decode($text);
# Print to output.
print "Text: $text\n";
print "Decoded text: $decoded_text\n";
# Output:
# Text: foo
# bar
# Decoded text: foo\nbar
EXAMPLE2
# Pragmas.
use strict;
use warnings;
# Modules.
use PYX::Utils qw(encode);
# Text.
my $text = 'foo\nbar';
# Encode text.
my $encoded_text = encode($text);
# Print to output.
print "Text: $text\n";
print "Encoded text: $encoded_text\n";
# Output:
# Text: foo\nbar
# Encoded text: foo
# bar
EXAMPLE3
# Pragmas.
use strict;
use warnings;
# Modules.
use PYX::Utils qw(entity_decode);
# Text.
my $text = 'foo<&"bar';
# Decode entities.
my $decoded_text = entity_decode($text);
# Print to output.
print "Text: $text\n";
print "Decoded entities: $decoded_text\n";
# Output:
# Text: foo<&"bar
# Decoded entities: foo<&"bar
EXAMPLE4
# Pragmas.
use strict;
use warnings;
# Modules.
use PYX::Utils qw(entity_encode);
# Text.
my $text = 'foo<&"bar';
# Encode entities.
my $encoded_text = entity_encode($text);
# Print to output.
print "Text: $text\n";
print "Encoded text: $encoded_text\n";
# Output:
# Text: foo<&"bar
# Encoded text: foo<&"bar
DEPENDENCIES
Exporter, HTML::Entities, Readonly.
SEE ALSO
PYX, PYX::GraphViz, PYX::Hist, PYX::Parser, PYX::Stack, Task::PYX.
REPOSITORY
<https://github.com/tupinek/PYX-Utils>
AUTHOR
Michal Å paÄek skim@cpan.org
LICENSE AND COPYRIGHT
© 2005-2015 Michal Å paÄek
BSD 2-Clause License
VERSION
0.03