Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with reusing the helpers object and nested helpers #677

Closed
Akron opened this issue Sep 22, 2014 · 1 comment
Closed

Problem with reusing the helpers object and nested helpers #677

Akron opened this issue Sep 22, 2014 · 1 comment

Comments

@Akron
Copy link
Contributor

Akron commented Sep 22, 2014

In the following simple script I create a nested helper and try to access it multiple times using the helpers proxy object.

#!/usr/bin/env perl
use Mojolicious::Lite;

# Create nested helper
helper 'foo.bar' => sub {
  return 'Yeah!'
};

# Access nested helpers through proxy object multiple times
get '/' => sub {
  my $c = shift;
  my $h = $c->helpers;
  $c->render(text => $h->foo->bar . $h->foo->bar);
};

app->start('get','/');

This spits out the following error in recent Mojolicious (5.42):

Can't locate object method "foo" via package "Mojolicious::Renderer::Helpers::3e4a80e493b3a4d2be5bfe6cbbb678ee"

I may misuse the helpers object when using it multiple times ... but I am confused by the error. The error obviously doen't occur when I access $foo = $h->foo once and $foo->bar multiple times.

@kraih kraih closed this as completed in db01d44 Sep 22, 2014
@kraih
Copy link
Member

kraih commented Sep 22, 2014

Thanks, fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants