PYX::Utils - A perl module for PYX common utilities.
use PYX::Utils; my $decoded_text = decode($text); my $encoded_text = encode($text); my $decoded_text = entity_decode($text); my $encoded_text = entity_encode($text);
decode
my $decoded_text = decode($text);
Decode characters. Currently decode newline to '\n'.
Returns decoded text.
encode
my $encoded_text = encode($text);
Encode characters. Currently encode '\n' to newline.
Returns encoded text.
entity_decode
my $decoded_text = entity_decode($text);
Decode entities.
'<' => '<' '&' => '&' '"' => '"'
entity_encode
my $encoded_text = entity_encode($text);
Encode some chars for HTML/XML/SGML. Currenctly encode these characters:
'<' => '<' '&' => '&' '"' => '"'
use strict; use warnings; 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
use strict; use warnings; 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
use strict; use warnings; 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
use strict; use warnings; 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
Exporter, HTML::Entities, Readonly.
Install the PYX modules.
https://github.com/michal-josef-spacek/PYX-Utils
Michal Josef Špaček skim@cpan.org
© 2005-2021 Michal Josef Špaček
BSD 2-Clause License
0.07
To install PYX::Utils, copy and paste the appropriate command in to your terminal.
cpanm
cpanm PYX::Utils
CPAN shell
perl -MCPAN -e shell install PYX::Utils
For more information on module installation, please visit the detailed CPAN module installation guide.