Skip to content

Commit

Permalink
more bytestream examples
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Apr 23, 2012
1 parent 6bf7359 commit 59fccf1
Show file tree
Hide file tree
Showing 2 changed files with 123 additions and 115 deletions.
22 changes: 15 additions & 7 deletions lib/Mojo/ByteStream.pm
Expand Up @@ -136,6 +136,8 @@ Alias for L<Mojo::Util/"b64_decode">.
Alias for L<Mojo::Util/"b64_encode">.
b('foo bar baz')->b64_encode('')->say;
=head2 C<camelize>
$stream = $stream->camelize;
Expand All @@ -157,30 +159,30 @@ Alias for L<Mojo::Util/"b64_decamelize">.
=head2 C<decode>
$stream = $stream->decode;
$stream = $stream->decode($encoding);
$stream = $stream->decode('iso-8859-1');
Alias for L<Mojo::Util/"decode">, defaults to C<UTF-8>.
$stream->decode('UTF-8')->to_string;
$stream->decode('UTF-16LE')->unquote->trim->say;
=head2 C<encode>
$stream = $stream->encode;
$stream = $stream->encode($encoding);
$stream = $stream->encode('iso-8859-1');
Alias for L<Mojo::Util/"encode">, defaults to C<UTF-8>.
$stream->encode('UTF-8')->to_string;
$stream->trim->quote->encode->say;
=head2 C<hmac_md5_sum>
$stream = $stream->hmac_md5_sum($secret);
$stream = $stream->hmac_md5_sum('passw0rd');
Alias for L<Mojo::Util/"hmac_md5_sum">.
=head2 C<hmac_sha1_sum>
$stream = $stream->hmac_sha1_sum($secret);
$stream = $stream->hmac_sha1_sum('passw0rd');
Alias for L<Mojo::Util/"hmac_sha1_sum">.
Expand All @@ -191,6 +193,8 @@ Alias for L<Mojo::Util/"hmac_sha1_sum">.
Alias for L<Mojo::Util/"html_escape">.
b('<html>')->html_escape->say;
=head2 C<html_unescape>
$stream = $stream->html_unescape;
Expand Down Expand Up @@ -252,6 +256,8 @@ Print bytestream to handle or STDOUT and append a newline.
Alias for L<Mojo::Util/"secure_compare">.
say 'Match!' if b('foo')->secure_compare('foo');
=head2 C<sha1_bytes>
$stream = $stream->sha1_bytes;
Expand All @@ -276,7 +282,7 @@ Size of bytestream.
Turn bytestream into L<Mojo::Collection>.
$stream->split(',')->map(sub { $_->quote })->join("\n")->say;
b('a,b,c')->split(',')->map(sub { $_->quote })->join("\n")->say;
=head2 C<to_string>
Expand All @@ -303,6 +309,8 @@ Alias for L<Mojo::Util/"unquote">.
Alias for L<Mojo::Util/"url_escape">.
b('foo bar baz')->url_escape->say;
=head2 C<url_unescape>
$stream = $stream->url_unescape;
Expand Down

0 comments on commit 59fccf1

Please sign in to comment.