.\" Automatically generated by Pod::Man 2.25 (Pod::Simple 3.16) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .ie \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . nr % 0 . rr F .\} .el \{\ . de IX .. .\} .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "Mojo::ByteStream 3pm" .TH Mojo::ByteStream 3pm "2012-09-05" "perl v5.14.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Mojo::ByteStream \- ByteStream .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 4 \& # Manipulate bytestreams \& use Mojo::ByteStream; \& my $stream = Mojo::ByteStream\->new(\*(Aqfoo_bar_baz\*(Aq); \& say $stream\->camelize; \& \& # Chain methods \& my $stream = Mojo::ByteStream\->new(\*(Aqfoo bar baz\*(Aq)\->quote; \& $stream = $stream\->unquote\->encode(\*(AqUTF\-8\*(Aq)\->b64_encode(\*(Aq\*(Aq); \& say $stream; \& \& # Use the alternative constructor \& use Mojo::ByteStream \*(Aqb\*(Aq; \& my $stream = b(\*(Aqfoobarbaz\*(Aq)\->html_escape; .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" Mojo::ByteStream provides a more friendly \s-1API\s0 for the bytestream manipulation functions in Mojo::Util. .SH "FUNCTIONS" .IX Header "FUNCTIONS" Mojo::ByteStream implements the following functions. .ie n .SS """b""" .el .SS "\f(CWb\fP" .IX Subsection "b" .Vb 1 \& my $stream = b(\*(Aqtest123\*(Aq); .Ve .PP Construct a new Mojo::ByteStream object. .SH "METHODS" .IX Header "METHODS" Mojo::ByteStream implements the following methods. .ie n .SS """new""" .el .SS "\f(CWnew\fP" .IX Subsection "new" .Vb 1 \& my $stream = Mojo::ByteStream\->new(\*(Aqtest123\*(Aq); .Ve .PP Construct a new Mojo::ByteStream object. .ie n .SS """b64_decode""" .el .SS "\f(CWb64_decode\fP" .IX Subsection "b64_decode" .Vb 1 \& $stream = $stream\->b64_decode; .Ve .PP Alias for \*(L"b64_decode\*(R" in Mojo::Util. .ie n .SS """b64_encode""" .el .SS "\f(CWb64_encode\fP" .IX Subsection "b64_encode" .Vb 2 \& $stream = $stream\->b64_encode; \& $stream = $stream\->b64_encode("\en"); .Ve .PP Alias for \*(L"b64_encode\*(R" in Mojo::Util. .PP .Vb 1 \& b(\*(Aqfoo bar baz\*(Aq)\->b64_encode(\*(Aq\*(Aq)\->say; .Ve .ie n .SS """camelize""" .el .SS "\f(CWcamelize\fP" .IX Subsection "camelize" .Vb 1 \& $stream = $stream\->camelize; .Ve .PP Alias for \*(L"camelize\*(R" in Mojo::Util. .ie n .SS """clone""" .el .SS "\f(CWclone\fP" .IX Subsection "clone" .Vb 1 \& my $stream2 = $stream\->clone; .Ve .PP Clone bytestream. .ie n .SS """decamelize""" .el .SS "\f(CWdecamelize\fP" .IX Subsection "decamelize" .Vb 1 \& $stream = $stream\->decamelize; .Ve .PP Alias for \*(L"b64_decamelize\*(R" in Mojo::Util. .ie n .SS """decode""" .el .SS "\f(CWdecode\fP" .IX Subsection "decode" .Vb 2 \& $stream = $stream\->decode; \& $stream = $stream\->decode(\*(Aqiso\-8859\-1\*(Aq); .Ve .PP Alias for \*(L"decode\*(R" in Mojo::Util, defaults to \f(CW\*(C`UTF\-8\*(C'\fR. .PP .Vb 1 \& $stream\->decode(\*(AqUTF\-16LE\*(Aq)\->unquote\->trim\->say; .Ve .ie n .SS """encode""" .el .SS "\f(CWencode\fP" .IX Subsection "encode" .Vb 2 \& $stream = $stream\->encode; \& $stream = $stream\->encode(\*(Aqiso\-8859\-1\*(Aq); .Ve .PP Alias for \*(L"encode\*(R" in Mojo::Util, defaults to \f(CW\*(C`UTF\-8\*(C'\fR. .PP .Vb 1 \& $stream\->trim\->quote\->encode\->say; .Ve .ie n .SS """hmac_md5_sum""" .el .SS "\f(CWhmac_md5_sum\fP" .IX Subsection "hmac_md5_sum" .Vb 1 \& $stream = $stream\->hmac_md5_sum(\*(Aqpassw0rd\*(Aq); .Ve .PP Alias for \*(L"hmac_md5_sum\*(R" in Mojo::Util. .ie n .SS """hmac_sha1_sum""" .el .SS "\f(CWhmac_sha1_sum\fP" .IX Subsection "hmac_sha1_sum" .Vb 1 \& $stream = $stream\->hmac_sha1_sum(\*(Aqpassw0rd\*(Aq); .Ve .PP Alias for \*(L"hmac_sha1_sum\*(R" in Mojo::Util. .PP .Vb 1 \& b(\*(Aqfoo bar baz\*(Aq)\->hmac_sha1_sum(\*(Aqsecr3t\*(Aq)\->quote\->say; .Ve .ie n .SS """html_escape""" .el .SS "\f(CWhtml_escape\fP" .IX Subsection "html_escape" .Vb 2 \& $stream = $stream\->html_escape; \& $stream = $stream\->html_escape(\*(Aq^\en\er\et !#$%(\-;=?\-~\*(Aq); .Ve .PP Alias for \*(L"html_escape\*(R" in Mojo::Util. .PP .Vb 1 \& b(\*(Aq\*(Aq)\->html_escape\->say; .Ve .ie n .SS """html_unescape""" .el .SS "\f(CWhtml_unescape\fP" .IX Subsection "html_unescape" .Vb 1 \& $stream = $stream\->html_unescape; .Ve .PP Alias for \*(L"html_unescape\*(R" in Mojo::Util. .PP .Vb 1 \& b(\*(Aq<html>\*(Aq)\->html_unescape\->url_escape\->say; .Ve .ie n .SS """md5_bytes""" .el .SS "\f(CWmd5_bytes\fP" .IX Subsection "md5_bytes" .Vb 1 \& $stream = $stream\->md5_bytes; .Ve .PP Alias for \*(L"md5_bytes\*(R" in Mojo::Util. .ie n .SS """md5_sum""" .el .SS "\f(CWmd5_sum\fP" .IX Subsection "md5_sum" .Vb 1 \& $stream = $stream\->md5_sum; .Ve .PP Alias for \*(L"md5_sum\*(R" in Mojo::Util. .ie n .SS """punycode_decode""" .el .SS "\f(CWpunycode_decode\fP" .IX Subsection "punycode_decode" .Vb 1 \& $stream = $stream\->punycode_decode; .Ve .PP Alias for \*(L"punycode_decode\*(R" in Mojo::Util. .ie n .SS """punycode_encode""" .el .SS "\f(CWpunycode_encode\fP" .IX Subsection "punycode_encode" .Vb 1 \& $stream = $stream\->punycode_encode; .Ve .PP Alias for \*(L"punycode_encode\*(R" in Mojo::Util. .ie n .SS """qp_decode""" .el .SS "\f(CWqp_decode\fP" .IX Subsection "qp_decode" .Vb 1 \& $stream = $stream\->qp_decode; .Ve .PP Alias for \*(L"qp_decode\*(R" in Mojo::Util. .ie n .SS """qp_encode""" .el .SS "\f(CWqp_encode\fP" .IX Subsection "qp_encode" .Vb 1 \& $stream = $stream\->qp_encode; .Ve .PP Alias for \*(L"qp_encode\*(R" in Mojo::Util. .ie n .SS """quote""" .el .SS "\f(CWquote\fP" .IX Subsection "quote" .Vb 1 \& $stream = $stream\->quote; .Ve .PP Alias for \*(L"quote\*(R" in Mojo::Util. .ie n .SS """say""" .el .SS "\f(CWsay\fP" .IX Subsection "say" .Vb 2 \& $stream\->say; \& $stream\->say(*STDERR); .Ve .PP Print bytestream to handle or \s-1STDOUT\s0 and append a newline. .ie n .SS """secure_compare""" .el .SS "\f(CWsecure_compare\fP" .IX Subsection "secure_compare" .Vb 1 \& my $success = $stream\->secure_compare($string); .Ve .PP Alias for \*(L"secure_compare\*(R" in Mojo::Util. .PP .Vb 1 \& say \*(AqMatch!\*(Aq if b(\*(Aqfoo\*(Aq)\->secure_compare(\*(Aqfoo\*(Aq); .Ve .ie n .SS """sha1_bytes""" .el .SS "\f(CWsha1_bytes\fP" .IX Subsection "sha1_bytes" .Vb 1 \& $stream = $stream\->sha1_bytes; .Ve .PP Alias for \*(L"sha1_bytes\*(R" in Mojo::Util. .ie n .SS """sha1_sum""" .el .SS "\f(CWsha1_sum\fP" .IX Subsection "sha1_sum" .Vb 1 \& $stream = $stream\->sha1_sum; .Ve .PP Alias for \*(L"sha1_sum\*(R" in Mojo::Util. .ie n .SS """size""" .el .SS "\f(CWsize\fP" .IX Subsection "size" .Vb 1 \& my $size = $stream\->size; .Ve .PP Size of bytestream. .ie n .SS """split""" .el .SS "\f(CWsplit\fP" .IX Subsection "split" .Vb 1 \& my $collection = $stream\->split(\*(Aq,\*(Aq); .Ve .PP Turn bytestream into Mojo::Collection. .PP .Vb 1 \& b(\*(Aqa,b,c\*(Aq)\->split(\*(Aq,\*(Aq)\->map(sub { $_\->quote })\->join("\en")\->say; .Ve .ie n .SS """to_string""" .el .SS "\f(CWto_string\fP" .IX Subsection "to_string" .Vb 1 \& my $string = $stream\->to_string; .Ve .PP Stringify bytestream. .ie n .SS """trim""" .el .SS "\f(CWtrim\fP" .IX Subsection "trim" .Vb 1 \& $stream = $stream\->trim; .Ve .PP Alias for \*(L"trim\*(R" in Mojo::Util. .ie n .SS """unquote""" .el .SS "\f(CWunquote\fP" .IX Subsection "unquote" .Vb 1 \& $stream = $stream\->unquote; .Ve .PP Alias for \*(L"unquote\*(R" in Mojo::Util. .ie n .SS """url_escape""" .el .SS "\f(CWurl_escape\fP" .IX Subsection "url_escape" .Vb 2 \& $stream = $stream\->url_escape; \& $stream = $stream\->url_escape(\*(Aq^A\-Za\-z0\-9\e\-._~\*(Aq); .Ve .PP Alias for \*(L"url_escape\*(R" in Mojo::Util. .PP .Vb 1 \& b(\*(Aqfoo bar baz\*(Aq)\->url_escape\->say; .Ve .ie n .SS """url_unescape""" .el .SS "\f(CWurl_unescape\fP" .IX Subsection "url_unescape" .Vb 1 \& $stream = $stream\->url_unescape; .Ve .PP Alias for \*(L"url_unescape\*(R" in Mojo::Util. .PP .Vb 1 \& b(\*(Aq%3Chtml%3E\*(Aq)\->url_unescape\->html_escape\->say; .Ve .ie n .SS """xml_escape""" .el .SS "\f(CWxml_escape\fP" .IX Subsection "xml_escape" .Vb 1 \& $stream = $stream\->xml_escape; .Ve .PP Alias for \*(L"xml_escape\*(R" in Mojo::Util. .SH "SEE ALSO" .IX Header "SEE ALSO" Mojolicious, Mojolicious::Guides, .