Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
order all methods alphabetically
  • Loading branch information
kraih committed Jan 24, 2014
1 parent 7a971ca commit 2862f46
Show file tree
Hide file tree
Showing 21 changed files with 279 additions and 279 deletions.
28 changes: 14 additions & 14 deletions lib/Mojo.pm
Expand Up @@ -23,6 +23,12 @@ has ua => sub {
return $ua;
};

sub build_tx { Mojo::Transaction::HTTP->new }

sub config { shift->_dict(config => @_) }

sub handler { croak 'Method "handler" not implemented in subclass' }

sub new {
my $self = shift->SUPER::new(@_);

Expand All @@ -35,12 +41,6 @@ sub new {
return $self;
}

sub build_tx { Mojo::Transaction::HTTP->new }

sub config { shift->_dict(config => @_) }

sub handler { croak 'Method "handler" not implemented in subclass' }

sub _dict {
my ($self, $name) = (shift, shift);

Expand Down Expand Up @@ -140,14 +140,6 @@ interfere with new blocking ones.
L<Mojo> inherits all methods from L<Mojo::Base> and implements the following
new ones.
=head2 new
my $app = Mojo->new;
Construct a new L<Mojo> application. Will automatically detect your home
directory if necessary and set up logging to C<log/mojo.log> if there's a
C<log> directory.
=head2 build_tx
my $tx = $app->build_tx;
Expand Down Expand Up @@ -181,6 +173,14 @@ be overloaded in a subclass.
...
}
=head2 new
my $app = Mojo->new;
Construct a new L<Mojo> application. Will automatically detect your home
directory if necessary and set up logging to C<log/mojo.log> if there's a
C<log> directory.
=head1 SEE ALSO
L<Mojolicious>, L<Mojolicious::Guides>, L<http://mojolicio.us>.
Expand Down
16 changes: 8 additions & 8 deletions lib/Mojo/Asset/Memory.pm
Expand Up @@ -7,8 +7,6 @@ use Mojo::Util 'spurt';
has 'auto_upgrade';
has max_memory_size => sub { $ENV{MOJO_MAX_MEMORY_SIZE} || 262144 };

sub new { shift->SUPER::new(@_, content => '') }

sub add_chunk {
my ($self, $chunk) = @_;

Expand Down Expand Up @@ -49,6 +47,8 @@ sub move_to {
return $self;
}

sub new { shift->SUPER::new(@_, content => '') }

sub size { length shift->{content} }

sub slurp { shift->{content} }
Expand Down Expand Up @@ -119,12 +119,6 @@ MOJO_MAX_MEMORY_SIZE environment variable or C<262144>.
L<Mojo::Asset::Memory> inherits all methods from L<Mojo::Asset> and implements
the following new ones.
=head2 new
my $mem = Mojo::Asset::Memory->new;
Construct a new L<Mojo::Asset::Memory> object.
=head2 add_chunk
$mem = $mem->add_chunk('foo bar baz');
Expand Down Expand Up @@ -152,6 +146,12 @@ chunk size of C<131072> bytes.
Move asset data into a specific file.
=head2 new
my $mem = Mojo::Asset::Memory->new;
Construct a new L<Mojo::Asset::Memory> object.
=head2 size
my $size = $mem->size;
Expand Down
28 changes: 14 additions & 14 deletions lib/Mojo/Base.pm
Expand Up @@ -40,11 +40,6 @@ sub import {
feature->import(':5.10');
}

sub new {
my $class = shift;
bless @_ ? @_ > 1 ? {@_} : {%{$_[0]}} : {}, ref $class || $class;
}

sub attr {
my ($class, $attrs, $default) = @_;
return unless ($class = ref $class || $class) && $attrs;
Expand Down Expand Up @@ -83,6 +78,11 @@ sub attr {
}
}

sub new {
my $class = shift;
bless @_ ? @_ > 1 ? {@_} : {%{$_[0]}} : {}, ref $class || $class;
}

sub tap {
my ($self, $cb) = @_;
$_->$cb for $self;
Expand Down Expand Up @@ -180,15 +180,6 @@ Create attributes for hash-based objects, just like the L</"attr"> method.
L<Mojo::Base> implements the following methods.
=head2 new
my $object = BaseSubClass->new;
my $object = BaseSubClass->new(name => 'value');
my $object = BaseSubClass->new({name => 'value'});
This base class provides a basic constructor for hash-based objects. You can
pass it either a hash or a hash reference with attribute values.
=head2 attr
$object->attr('name');
Expand All @@ -206,6 +197,15 @@ be executed at accessor read time if there's no set value. Accessors can be
chained, that means they return their invocant when they are called with an
argument.
=head2 new
my $object = BaseSubClass->new;
my $object = BaseSubClass->new(name => 'value');
my $object = BaseSubClass->new({name => 'value'});
This base class provides a basic constructor for hash-based objects. You can
pass it either a hash or a hash reference with attribute values.
=head2 tap
$object = $object->tap(sub {...});
Expand Down
22 changes: 11 additions & 11 deletions lib/Mojo/ByteStream.pm
Expand Up @@ -24,11 +24,6 @@ for my $name (@UTILS) {
};
}

sub new {
my $class = shift;
return bless \(my $dummy = join '', @_), ref $class || $class;
}

sub b { __PACKAGE__->new(@_) }

sub clone { $_[0]->new(${$_[0]}) }
Expand All @@ -45,6 +40,11 @@ sub encode {
return $self;
}

sub new {
my $class = shift;
return bless \(my $dummy = join '', @_), ref $class || $class;
}

sub say {
my ($self, $handle) = @_;
$handle ||= \*STDOUT;
Expand Down Expand Up @@ -112,12 +112,6 @@ Construct a new scalar-based L<Mojo::ByteStream> object.
L<Mojo::ByteStream> implements the following methods.
=head2 new
my $stream = Mojo::ByteStream->new('test123');
Construct a new scalar-based L<Mojo::ByteStream> object.
=head2 b64_decode
$stream = $stream->b64_decode;
Expand Down Expand Up @@ -197,6 +191,12 @@ Generate binary MD5 checksum for bytestream with L<Mojo::Util/"md5_bytes">.
Generate MD5 checksum for bytestream with L<Mojo::Util/"md5_sum">.
=head2 new
my $stream = Mojo::ByteStream->new('test123');
Construct a new scalar-based L<Mojo::ByteStream> object.
=head2 punycode_decode
$stream = $stream->punycode_decode;
Expand Down
22 changes: 11 additions & 11 deletions lib/Mojo/Collection.pm
Expand Up @@ -24,11 +24,6 @@ sub AUTOLOAD {

sub DESTROY { }

sub new {
my $class = shift;
return bless [@_], ref $class || $class;
}

sub c { __PACKAGE__->new(@_) }

sub compact {
Expand Down Expand Up @@ -65,6 +60,11 @@ sub map {
return $self->new(map { $_->$cb } @$self);
}

sub new {
my $class = shift;
return bless [@_], ref $class || $class;
}

sub pluck {
my ($self, $method, @args) = @_;
return $self->map(sub { $_->$method(@args) });
Expand Down Expand Up @@ -152,12 +152,6 @@ Construct a new array-based L<Mojo::Collection> object.
L<Mojo::Collection> implements the following methods.
=head2 new
my $collection = Mojo::Collection->new(1, 2, 3);
Construct a new array-based L<Mojo::Collection> object.
=head2 compact
my $new = $collection->compact;
Expand Down Expand Up @@ -230,6 +224,12 @@ callback and is also available as C<$_>.
my $doubled = $collection->map(sub { $_ * 2 });
=head2 new
my $collection = Mojo::Collection->new(1, 2, 3);
Construct a new array-based L<Mojo::Collection> object.
=head2 pluck
my $new = $collection->pluck($method);
Expand Down
26 changes: 13 additions & 13 deletions lib/Mojo/Content/MultiPart.pm
Expand Up @@ -5,12 +5,6 @@ use Mojo::Util 'b64_encode';

has parts => sub { [] };

sub new {
my $self = shift->SUPER::new(@_);
$self->on(read => \&_read);
return $self;
}

sub body_contains {
my ($self, $chunk) = @_;
for my $part (@{$self->parts}) {
Expand Down Expand Up @@ -111,6 +105,12 @@ sub get_body_chunk {

sub is_multipart {1}

sub new {
my $self = shift->SUPER::new(@_);
$self->on(read => \&_read);
return $self;
}

sub _parse_multipart_body {
my ($self, $boundary) = @_;

Expand Down Expand Up @@ -256,13 +256,6 @@ L<Mojo::Content::Single> objects.
L<Mojo::Content::MultiPart> inherits all methods from L<Mojo::Content> and
implements the following new ones.
=head2 new
my $multi = Mojo::Content::MultiPart->new;
Construct a new L<Mojo::Content::MultiPart> object and subscribe to L</"read">
event with default content parser.
=head2 body_contains
my $bool = $multi->body_contains('foobarbaz');
Expand Down Expand Up @@ -299,6 +292,13 @@ Get a chunk of content starting from a specific position.
True.
=head2 new
my $multi = Mojo::Content::MultiPart->new;
Construct a new L<Mojo::Content::MultiPart> object and subscribe to L</"read">
event with default content parser.
=head1 SEE ALSO
L<Mojolicious>, L<Mojolicious::Guides>, L<http://mojolicio.us>.
Expand Down
28 changes: 14 additions & 14 deletions lib/Mojo/Content/Single.pm
Expand Up @@ -7,13 +7,6 @@ use Mojo::Content::MultiPart;
has asset => sub { Mojo::Asset::Memory->new(auto_upgrade => 1) };
has auto_upgrade => 1;

sub new {
my $self = shift->SUPER::new(@_);
$self->{read}
= $self->on(read => sub { $_[0]->asset($_[0]->asset->add_chunk($_[1])) });
return $self;
}

sub body_contains { shift->asset->contains(shift) >= 0 }

sub body_size {
Expand All @@ -34,6 +27,13 @@ sub get_body_chunk {
return $self->asset->get_chunk($offset);
}

sub new {
my $self = shift->SUPER::new(@_);
$self->{read}
= $self->on(read => sub { $_[0]->asset($_[0]->asset->add_chunk($_[1])) });
return $self;
}

sub parse {
my $self = shift;

Expand Down Expand Up @@ -118,13 +118,6 @@ L<Mojo::Content::MultiPart> object, defaults to C<1>.
L<Mojo::Content::Single> inherits all methods from L<Mojo::Content> and
implements the following new ones.
=head2 new
my $single = Mojo::Content::Single->new;
Construct a new L<Mojo::Content::Single> object and subscribe to L</"read">
event with default content parser.
=head2 body_contains
my $bool = $single->body_contains('1234567');
Expand All @@ -149,6 +142,13 @@ Clone content if possible, otherwise return C<undef>.
Get a chunk of content starting from a specific position.
=head2 new
my $single = Mojo::Content::Single->new;
Construct a new L<Mojo::Content::Single> object and subscribe to L</"read">
event with default content parser.
=head2 parse
$single = $single->parse("Content-Length: 12\x0d\x0a\x0d\x0aHello World!");
Expand Down

0 comments on commit 2862f46

Please sign in to comment.