Skip to content

Commit

Permalink
made Mojolicious a little more marcus-proof
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Oct 6, 2011
1 parent 9b31238 commit d1cf14a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/Mojolicious.pm
Expand Up @@ -10,7 +10,7 @@ use Mojolicious::Routes;
use Mojolicious::Sessions;
use Mojolicious::Static;
use Mojolicious::Types;
use Scalar::Util 'weaken';
use Scalar::Util qw/blessed weaken/;

# "Robots don't have any emotions, and sometimes that makes me very sad."
has controller_class => 'Mojolicious::Controller';
Expand Down Expand Up @@ -44,6 +44,8 @@ sub AUTOLOAD {

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

# Check for helper
croak qq/Can't locate object method "$method" via package "$package"/
Expand Down
3 changes: 3 additions & 0 deletions lib/Mojolicious/Controller.pm
Expand Up @@ -10,6 +10,7 @@ use Mojo::URL;
use Mojo::Util;

require Carp;
require Scalar::Util;

# "Scalpel... blood bucket... priest."
has [qw/app match/];
Expand Down Expand Up @@ -40,6 +41,8 @@ sub AUTOLOAD {

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

# Call helper
Carp::croak(qq/Can't locate object method "$method" via package "$package"/)
Expand Down

0 comments on commit d1cf14a

Please sign in to comment.