Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fixed AUTOLOAD bug in Mojo::Collection where it would behave differen…
…tly than calling pluck directly
  • Loading branch information
kraih committed Jul 3, 2014
1 parent 33b13e0 commit 609850e
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 8 deletions.
2 changes: 2 additions & 0 deletions Changes
@@ -1,6 +1,8 @@

5.12 2014-07-04
- Fixed a few multipart form handling bugs.
- Fixed AUTOLOAD bug in Mojo::Collection where it would behave differently
than calling pluck directly.

5.11 2014-07-02
- Moved reverse_proxy attribute from Mojo::Server::Daemon to Mojo::Server.
Expand Down
4 changes: 0 additions & 4 deletions lib/Mojo/Collection.pm
Expand Up @@ -15,13 +15,9 @@ our @EXPORT_OK = ('c');

sub AUTOLOAD {
my $self = shift;

my ($package, $method) = split /::(\w+)$/, our $AUTOLOAD;
croak "Undefined subroutine &${package}::$method called"
unless blessed $self && $self->isa(__PACKAGE__);

croak qq{Can't locate object method "$method" via package "$package"}
unless @$self;
return $self->pluck($method, @_);
}

Expand Down
4 changes: 0 additions & 4 deletions t/mojo/collection.t
Expand Up @@ -152,10 +152,6 @@ is_deeply [$collection->uniq->reverse->uniq->each], [5, 4, 3, 2, 1],
'right result';

# Missing method and function (AUTOLOAD)
eval { Mojo::Collection->new->missing };
like $@,
qr/^Can't locate object method "missing" via package "Mojo::Collection"/,
'right error';
eval { Mojo::Collection->new(b('whatever'))->missing };
like $@,
qr/^Can't locate object method "missing" via package "Mojo::ByteStream"/,
Expand Down

0 comments on commit 609850e

Please sign in to comment.