Skip to content

Commit

Permalink
small optimizations
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Oct 25, 2013
1 parent f1ff9bf commit 6ec64c3
Showing 1 changed file with 3 additions and 14 deletions.
17 changes: 3 additions & 14 deletions lib/Mojo/UserAgent/Transactor.pm
Expand Up @@ -13,14 +13,9 @@ use Mojo::Transaction::WebSocket;
use Mojo::URL;
use Mojo::Util 'encode';

has generators => sub { {} };
has generators => sub { {form => \&_form, json => \&_json} };
has name => 'Mojolicious (Perl)';

sub new {
my $self = shift->SUPER::new(@_);
return $self->add_generator(form => \&_form)->add_generator(json => \&_json);
}

sub add_generator {
my ($self, $name, $cb) = @_;
$self->generators->{$name} = $cb;
Expand Down Expand Up @@ -294,7 +289,8 @@ L<Mojo::UserAgent::Transactor> implements the following attributes.
my $generators = $t->generators;
$t = $t->generators({foo => sub {...}});
Registered content generators.
Registered content generators, by default only C<form> and C<json> are already
defined.
=head2 name
Expand All @@ -309,13 +305,6 @@ C<Mojolicious (Perl)>.
L<Mojo::UserAgent::Transactor> inherits all methods from L<Mojo::Base> and
implements the following new ones.
=head2 new
my $t = Mojo::UserAgent::Transactor->new;
Construct a new transactor and register C<form> and C<json> content
generators.
=head2 add_generator
$t = $t->add_generator(foo => sub {...});
Expand Down

0 comments on commit 6ec64c3

Please sign in to comment.