Skip to content

Commit

Permalink
documentation tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Mar 8, 2013
1 parent c07b634 commit 4c97438
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 11 deletions.
3 changes: 1 addition & 2 deletions lib/Mojo/DOM.pm
Expand Up @@ -18,12 +18,11 @@ use Scalar::Util qw(blessed weaken);
sub AUTOLOAD {
my $self = shift;

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

# Search children
# Search children of current element
my $children = $self->children($method);
return @$children > 1 ? $children : $children->[0] if @$children;
croak qq{Can't locate object method "$method" via package "$package"};
Expand Down
5 changes: 1 addition & 4 deletions lib/Mojolicious.pm
Expand Up @@ -45,16 +45,13 @@ our $VERSION = '3.90';
sub AUTOLOAD {
my $self = shift;

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

# Check for helper
# Call helper with fresh controller
croak qq{Can't locate object method "$method" via package "$package"}
unless my $helper = $self->renderer->helpers->{$method};

# Call helper with fresh controller
return $self->controller_class->new(app => $self)->$helper(@_);
}

Expand Down
3 changes: 1 addition & 2 deletions lib/Mojolicious/Controller.pm
Expand Up @@ -28,12 +28,11 @@ my %RESERVED = map { $_ => 1 } (
sub AUTOLOAD {
my $self = shift;

# Method
my ($package, $method) = our $AUTOLOAD =~ /^([\w:]+)::(\w+)$/;
Carp::croak "Undefined subroutine &${package}::$method called"
unless Scalar::Util::blessed $self && $self->isa(__PACKAGE__);

# Call helper
# Call helper with current controller
Carp::croak qq{Can't locate object method "$method" via package "$package"}
unless my $helper = $self->app->renderer->helpers->{$method};
return $self->$helper(@_);
Expand Down
1 change: 0 additions & 1 deletion lib/Mojolicious/Guides/Cookbook.pod
Expand Up @@ -139,7 +139,6 @@ proxy, which even supports WebSockets in newer versions.
listen 80;
server_name localhost;
location / {
proxy_read_timeout 300;
proxy_pass http://myapp;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
Expand Down
3 changes: 1 addition & 2 deletions lib/Mojolicious/Routes/Route.pm
Expand Up @@ -12,12 +12,11 @@ has pattern => sub { Mojolicious::Routes::Pattern->new };
sub AUTOLOAD {
my $self = shift;

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

# Call shortcut
# Call shortcut with current route
croak qq{Can't locate object method "$method" via package "$package"}
unless my $shortcut = $self->root->shortcuts->{$method};
return $self->$shortcut(@_);
Expand Down

0 comments on commit 4c97438

Please sign in to comment.