Skip to content

Commit

Permalink
slightly more consistent synopsis examples
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Nov 19, 2013
1 parent 77c5c4b commit a74701e
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 6 deletions.
3 changes: 2 additions & 1 deletion lib/Mojo/ByteStream.pm
Expand Up @@ -74,8 +74,9 @@ Mojo::ByteStream - ByteStream
=head1 SYNOPSIS
# Manipulate bytestreams
use Mojo::ByteStream;
# Manipulate bytestream
my $stream = Mojo::ByteStream->new('foo_bar_baz');
say $stream->camelize;
Expand Down
7 changes: 5 additions & 2 deletions lib/Mojo/Collection.pm
Expand Up @@ -110,11 +110,14 @@ Mojo::Collection - Collection
=head1 SYNOPSIS
# Manipulate collections
use Mojo::Collection;
# Manipulate collection
my $collection = Mojo::Collection->new(qw(just works));
unshift @$collection, 'it';
$collection->map(sub { ucfirst })->each(sub {
# Chain methods
$collection->map(sub { ucfirst })->shuffle->each(sub {
my ($word, $count) = @_;
say "$count: $word";
});
Expand Down
3 changes: 2 additions & 1 deletion lib/Mojo/JSON.pm
Expand Up @@ -329,8 +329,9 @@ Mojo::JSON - Minimalistic JSON
=head1 SYNOPSIS
# Encode and decode JSON
use Mojo::JSON;
# Encode and decode JSON
my $json = Mojo::JSON->new;
my $bytes = $json->encode({foo => [1, 2], bar => 'hello!', baz => \1});
my $hash = $json->decode($bytes);
Expand Down
2 changes: 1 addition & 1 deletion lib/Mojo/Template.pm
Expand Up @@ -326,9 +326,9 @@ Mojo::Template - Perl-ish templates!
=head1 SYNOPSIS
use Mojo::Template;
my $mt = Mojo::Template->new;
# Simple
my $mt = Mojo::Template->new;
my $output = $mt->render(<<'EOF');
% use Time::Piece;
<!DOCTYPE html>
Expand Down
2 changes: 1 addition & 1 deletion lib/Mojo/UserAgent.pm
Expand Up @@ -458,9 +458,9 @@ Mojo::UserAgent - Non-blocking I/O HTTP and WebSocket user agent
=head1 SYNOPSIS
use Mojo::UserAgent;
my $ua = Mojo::UserAgent->new;
# Say hello to the Unicode snowman with "Do Not Track" header
my $ua = Mojo::UserAgent->new;
say $ua->get('www.☃.net?hello=there' => {DNT => 1})->res->body;
# Form POST with exception handling
Expand Down

0 comments on commit a74701e

Please sign in to comment.