Skip to content

Commit

Permalink
Fix can() so that it will nto die when called on a package
Browse files Browse the repository at this point in the history
The Catalyst test body_fh.t was exploding because it gets this 'can'
method on it's object. The latest Test::Builder alpha also calls
->can(...) on test packages, in this case causing an error since the
package is not a hashref, but instead is just a string.

This will do the expected behavior for plack, but not explode if someone
calls 'can' on the package.
  • Loading branch information
Chad Granum committed Jul 5, 2014
1 parent 3d24e59 commit b083bf7
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/Plack/Util.pm
Expand Up @@ -309,7 +309,8 @@ package Plack::Util::Prototype;

our $AUTOLOAD;
sub can {
$_[0]->{$_[1]};
return $_[0]->{$_[1]} if Scalar::Util::blessed($_[0]);
goto &UNIVERSAL::can;
}

sub AUTOLOAD {
Expand Down

0 comments on commit b083bf7

Please sign in to comment.