Skip to content

Commit

Permalink
Merge pull request #18 from rjbs/ctx-ref-safe
Browse files Browse the repository at this point in the history
do not die when $ctx is non-hash non-blessed ref
  • Loading branch information
pvande committed Mar 4, 2015
2 parents 94e73a8 + b064b71 commit c093d15
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/Template/Mustache.pm
Expand Up @@ -9,6 +9,7 @@ use warnings;

use CGI ();
use File::Spec;
use Scalar::Util 'blessed';

use version 0.77; our $VERSION = qv("v0.5.1");

Expand Down Expand Up @@ -275,8 +276,7 @@ sub lookup {
next unless exists $ctx->{$field};
$value = $ctx->{$field};
last;
} else {
next unless UNIVERSAL::can($ctx, $field);
} elsif (blessed($ctx) && $ctx->can($field)) {;
$value = $ctx->$field();
last;
}
Expand Down

0 comments on commit c093d15

Please sign in to comment.