Skip to content

Commit

Permalink
use more JSON Pointers in examples
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Aug 20, 2012
1 parent 55ffb3a commit e14dedd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
3 changes: 3 additions & 0 deletions Changes
@@ -1,4 +1,7 @@

3.33 2012-08-21
- Improved documentation.

3.32 2012-08-20
- Added event sequentialization support to delay method in Mojo::IOLoop.
(judofyr, marcus, sri)
Expand Down
8 changes: 4 additions & 4 deletions lib/Mojolicious/Guides/Cookbook.pod
Expand Up @@ -326,7 +326,7 @@ L<Mojo::IOLoop> delay.
# Parallel requests
sub {
my $delay = shift;
my $url = Mojo::URL->new('http://search.twitter.com/search.json');
my $url = Mojo::URL->new('http://search.twitter.com/search.json');
$self->ua->get($url->clone->query({q => 'perl'}) => $delay->begin);
$self->ua->get($url->clone->query({q => 'python'}) => $delay->begin);
},
Expand All @@ -335,8 +335,8 @@ L<Mojo::IOLoop> delay.
sub {
my ($delay, $perl, $python) = @_;
$self->render(json => {
perl => $perl->res->json->{results}[0]{text},
python => $python->res->json->{results}[0]{text}
perl => $perl->res->json('/results/0/text'),
python => $python->res->json('/results/0/text')
});
}
);
Expand Down Expand Up @@ -654,7 +654,7 @@ Who actually controls the event loop backend is not important.
my $ua = Mojo::UserAgent->new;
$ua->get('http://search.twitter.com/search.json?q=perl' => sub {
my ($ua, $tx) = @_;
$cv->send($tx->res->json->{results}[0]{text});
$cv->send($tx->res->json('/results/0/text'));
});
say $cv->recv;

Expand Down

0 comments on commit e14dedd

Please sign in to comment.