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

use class_to_path to load modules in Mojo::Base #1153

Merged
merged 1 commit into from Nov 7, 2017

Conversation

Grinnz
Copy link
Contributor

@Grinnz Grinnz commented Nov 7, 2017

Summary

With circular require issues solved, class_to_path can be reused in Mojo::Base for loading modules.

Motivation

Code reuse

References

$file =~ s!::|'!/!g;
require "$file.pm";
elsif ($flags[0] && !$flags[0]->can('new')) {
require(Mojo::Util::class_to_path($flags[0]));
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Parentheses are needed for Mojo::Util::class_to_path to avoid circular require issues. Parentheses are needed for require to avoid weird syntax errors possibly related to indirect object syntax.

@kraih kraih merged commit de9ee91 into mojolicious:master Nov 7, 2017
@Grinnz Grinnz deleted the mojo_base_class_to_path branch November 7, 2017 22:29
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