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

Do not overwrite matchvars #574

Closed
wants to merge 1 commit into from
Closed

Do not overwrite matchvars #574

wants to merge 1 commit into from

Conversation

ghost
Copy link

@ghost ghost commented Dec 24, 2013

Mojolicious::Controller::AUTOLOAD overwrites matchvars, when passed as argument.

use Mojolicious::Lite;

helper foo => sub {
    shift->render(text => "args: $_[0], $_[1]\n");
};

get '/' => sub {
    "bar baz" =~ /(\w+) (\w+)/;
    shift->foo($1, $2);
};

app->start;

output:

Content-Length: 35
Content-Type: text/html;charset=UTF-8
Status: 200 OK
Date: Tue, 24 Dec 2013 04:45:53 GMT

args: Mojolicious::Controller, foo

@kraih
Copy link
Member

kraih commented Dec 24, 2013

That might be a better AUTOLOAD idiom, is there a performance difference? If we decide to switch, it has to be consistent everywhere in Mojolicious though.

@kraih kraih closed this in 219b4b1 Dec 24, 2013
@kraih
Copy link
Member

kraih commented Dec 24, 2013

Doesn't appear to be a measurable difference.

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

Successfully merging this pull request may close these issues.

None yet

2 participants