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

Warnings when using Mojo::Util standalone #770

Closed
e477 opened this issue Mar 24, 2015 · 4 comments
Closed

Warnings when using Mojo::Util standalone #770

e477 opened this issue Mar 24, 2015 · 4 comments

Comments

@e477
Copy link

e477 commented Mar 24, 2015

I like using Mojo::Util as a convenient set of tools outside of Mojolicious projects, too. Since commit 413320b released with 6.04 I get the following warnings when trying to do so:

Useless use of a constant ("has") in void context at /usr/share/perl5/vendor_perl/Mojo/Base.pm line 39.
Useless use of reference constructor in void context at /usr/share/perl5/vendor_perl/Mojo/Base.pm line 39.
Useless use of private variable in void context at /usr/share/perl5/vendor_perl/Mojo/Base.pm line 65.
Useless use of reference constructor in void context at /usr/share/perl5/vendor_perl/Mojo/Base.pm line 65.
Useless use of private variable in void context at /usr/share/perl5/vendor_perl/Mojo/Base.pm line 73.
Useless use of reference constructor in void context at /usr/share/perl5/vendor_perl/Mojo/Base.pm line 73.
Useless use of private variable in void context at /usr/share/perl5/vendor_perl/Mojo/Base.pm line 77.
Useless use of reference constructor in void context at /usr/share/perl5/vendor_perl/Mojo/Base.pm line 77.
@kraih
Copy link
Member

kraih commented Mar 24, 2015

Thanks, fixed. I'm not happy with the solution though, and might just revert the original optimization instead. 5adf558

@kraih kraih closed this as completed Mar 24, 2015
@shadowcat-mst
Copy link
Contributor

02:16 @mst sri: isn't that just a circular require problem?
02:16 @mst yep
02:16 @sri possibly, the warnings are very useless though
02:21 @sri curious how "Mojo::Util::monkey_patch $caller, 'has', sub {
attr($caller, @_) };" causes "Useless use of a constant ("has") in
void context at lib/Mojo/Base.pm line 39."
02:21 @sri i guess Mojo::Util::monkey_patch is not yet defined
02:21 @sri triggering that oddity
02:21 @mst and so you parse it as indirect object notation
02:21 @mst $caller->Mojo::Util::monkey_patch(), 'has', ...
02:21 @sri oh shit... of course... indirect object notation
02:22 @sri facepalm
02:22 @mst which is what ciruclar requires cause, which can easily break
things later, which is why I went "ew" at this
02:22 @mst Moose::Util::TypeConstraints predeclares its subs for exactly this
reason
02:22 @sri i guess i can predeclare monkey_patch
02:23 @mst right
02:23 @mst sub monkey_patch;
02:23 @mst sorts it out

@Tekki
Copy link

Tekki commented Mar 24, 2015

Will this solve the following problem too?

use Mojo::Util;
use Mojo::UserAgent;

results in "syntax error at [...]/Mojo/IOLoop/Client.pm line 30, near "has reactor".

@kraih
Copy link
Member

kraih commented Mar 24, 2015

@Tekki Yes.

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

4 participants