Skip to content

Commit

Permalink
Mango is no longer recommended
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Sep 25, 2014
1 parent 0167391 commit d1fd06e
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 36 deletions.
2 changes: 1 addition & 1 deletion Changes
@@ -1,5 +1,5 @@

5.45 2014-09-24
5.45 2014-09-25

5.44 2014-09-23
- Fixed bug in Mojolicious::Renderer that prevented proxy objects from being
Expand Down
17 changes: 0 additions & 17 deletions lib/Mojolicious/Guides.pod
Expand Up @@ -126,23 +126,6 @@ Fun one-liners using everything above.

=back

=head1 SPIN-OFFS

These modules are not part of the L<Mojolicious> distribution, but have been
designed to be used with it and are being developed under the same umbrella.

=over 2

=item L<Mango>

Pure-Perl non-blocking I/O MongoDB driver.

=item L<Minion>

Job queue.

=back

=head1 REFERENCE

This is the class hierarchy of the L<Mojolicious> distribution.
Expand Down
24 changes: 12 additions & 12 deletions lib/Mojolicious/Guides/Cookbook.pod
Expand Up @@ -419,7 +419,7 @@ style.
use Mojolicious::Lite;
use Mojo::URL;

# Search MetaCPAN for "mojo" and "mango"
# Search MetaCPAN for "mojo" and "minion"
get '/' => sub {
my $c = shift;

Expand All @@ -431,16 +431,16 @@ style.
my $delay = shift;
my $url = Mojo::URL->new('api.metacpan.org/v0/module/_search');
$url->query({sort => 'date:desc'});
$c->ua->get($url->clone->query({q => 'mojo'}) => $delay->begin);
$c->ua->get($url->clone->query({q => 'mango'}) => $delay->begin);
$c->ua->get($url->clone->query({q => 'mojo'}) => $delay->begin);
$c->ua->get($url->clone->query({q => 'minion'}) => $delay->begin);
},

# Delayed rendering
sub {
my ($delay, $mojo, $mango) = @_;
my ($delay, $mojo, $minion) = @_;
$c->render(json => {
mojo => $mojo->res->json('/hits/hits/0/_source/release'),
mango => $mango->res->json('/hits/hits/0/_source/release')
mojo => $mojo->res->json('/hits/hits/0/_source/release'),
minion => $minion->res->json('/hits/hits/0/_source/release')
});
}
);
Expand Down Expand Up @@ -947,7 +947,7 @@ content repeatedly for multiple requests.

# Send multiple files streaming via PUT and POST
$ua->put('http://example.com/upload' => stream => '/home/sri/mojo.png');
$ua->post('http://example.com/upload' => stream => '/home/sri/mango.png');
$ua->post('http://example.com/upload' => stream => '/home/sri/minion.png');

The C<json> and C<form> content generators are always available.

Expand Down Expand Up @@ -1079,8 +1079,8 @@ can keep many concurrent connections active at the same time.
my ($ua, $mojo) = @_;
...
});
$ua->get('http://metacpan.org/search?q=mango' => sub {
my ($ua, $mango) = @_;
$ua->get('http://metacpan.org/search?q=minion' => sub {
my ($ua, $minion) = @_;
...
});

Expand All @@ -1100,11 +1100,11 @@ synchronize multiple non-blocking requests.
# Synchronize non-blocking requests
my $ua = Mojo::UserAgent->new;
my $delay = Mojo::IOLoop->delay(sub {
my ($delay, $mojo, $mango) = @_;
my ($delay, $mojo, $minion) = @_;
...
});
$ua->get('http://metacpan.org/search?q=mojo' => $delay->begin);
$ua->get('http://metacpan.org/search?q=mango' => $delay->begin);
$ua->get('http://metacpan.org/search?q=mojo' => $delay->begin);
$ua->get('http://metacpan.org/search?q=minion' => $delay->begin);
$delay->wait;

The call to L<Mojo::IOLoop::Delay/"wait"> makes this code portable, it can now
Expand Down
12 changes: 6 additions & 6 deletions lib/Mojolicious/Guides/Rendering.pod
Expand Up @@ -1355,22 +1355,22 @@ that need to be automatically encoded, but this can be easily disabled if
you're generating bytes instead.

use Mojolicious::Lite;
use Mango::BSON ':bson';
use Storable 'nfreeze';

# Add "bson" handler
app->renderer->add_handler(bson => sub {
# Add "storable" handler
app->renderer->add_handler(storable => sub {
my ($renderer, $c, $output, $options) = @_;

# Disable automatic encoding
delete $options->{encoding};

# Encode BSON data from stash value
$$output = bson_encode delete $c->stash->{bson};
# Encode data from stash value
$$output = nfreeze delete $c->stash->{storable};

return 1;
});

get '/' => {bson => {i => '♥ mojolicious'}, handler => 'bson'};
get '/' => {storable => {i => '♥ mojolicious'}, handler => 'storable'};

app->start;

Expand Down

2 comments on commit d1fd06e

@ovntatar
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would be interested in to know the reason of that!

@kraih
Copy link
Member Author

@kraih kraih commented on d1fd06e Sep 25, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.