NAME
Mojo::ByteStream - ByteStream
SYNOPSIS
use Mojo::ByteStream;
my $stream = Mojo::ByteStream->new('foobarbaz');
$stream->camelize;
$stream->decamelize;
$stream->b64_encode;
$stream->b64_decode;
$stream->encode('UTF-8');
$stream->decode('UTF-8');
$stream->html_escape;
$stream->html_unescape;
$stream->md5_sum;
$stream->qp_encode;
$stream->qp_decode;
$stream->quote;
$stream->unquote;
$stream->url_escape;
$stream->url_sanitize;
$stream->url_unescape;
$stream->xml_escape;
my $size = $stream->size;
my $stream2 = $stream->clone;
print $stream2->to_string;
# Chained
my $stream = Mojo::ByteStream->new('foo bar baz')->quote;
$stream = $stream->unquote->encode('UTF-8)->b64_encode;
print "$stream";
# Constructor alias
use Mojo::ByteStream 'b';
my $stream = b('foobarbaz')->html_escape;
DESCRIPTION
Mojo::ByteStream provides portable text and bytestream manipulation functions.
METHODS
Mojo::ByteStream inherits all methods from Mojo::Base and implements the following new ones.
new
my $stream = Mojo::ByteStream->new($string);
b64_decode
$stream = $stream->b64_decode;
b64_encode
$stream = $stream->b64_encode;
camelize
$stream = $stream->camelize;
clone
my $stream2 = $stream->clone;
decamelize
$stream = $stream->decamelize;
decode
$stream = $stream->decode($encoding);
encode
$stream = $stream->encode($encoding);
html_escape
$stream = $stream->html_escape;
html_unescape
$stream = $stream->html_unescape;
md5_sum
$stream = $stream->md5_sum;
qp_decode
$stream = $stream->qp_decode;
qp_encode
$stream = $stream->qp_encode;
quote
$stream = $stream->quote;
size
my $size = $stream->size;
to_string
my $string = $stream->to_string;
unquote
$stream = $stream->unquote;
url_escape
$stream = $stream->url_escape;
$stream = $stream->url_escape('A-Za-z0-9\-\.\_\~');
url_sanitize
$stream = $stream->url_sanitize;
url_unescape
$stream = $stream->url_unescape;
xml_escape
$stream = $stream->xml_escape;