Skip Menu |

This queue is for tickets about the Moose CPAN distribution.

Report information
The Basics
Id: 98393
Status: resolved
Priority: 0/
Queue: Moose

People
Owner: Nobody in particular
Requestors: arfreitas [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 2.1211
Fixed in: (no value)



Subject: Useless use of private variable in void context when checking syntax
Hello there, These errors are always raised when I try to use Vim + perl-support + Perlbrew when editing scripts with Moose: /home/foobar/perl5/perlbrew/perls/perl-5.16.3/lib/site_perl/5.16.3/x86_64-linux/Moose/Util/TypeConstraints.pm|677| Useless use of private variable in void context /home/foobar/perl5/perlbrew/perls/perl-5.16.3/lib/site_perl/5.16.3/x86_64-linux/Moose/Util/TypeConstraints.pm|683| Useless use of private variable in void context /home/foobar/perl5/perlbrew/perls/perl-5.16.3/lib/site_perl/5.16.3/x86_64-linux/Moose/Util/TypeConstraints.pm|704| Useless use of private variable in void context Even though the code in TypeConstraings.pm is explicit disabling the warning: sub _parse_parameterized_type_constraint { { no warnings 'void'; $any; } # force capture of interpolated lexical $_[0] =~ m{ $type_capture_parts }x; return ( $1, $2 ); } Checking the syntax from the shell still shows an even more strange error: [foobar@localhost ~]$ perl -cw /home/foobar/perl5/perlbrew/perls/perl-5.16.3/lib/site_perl/5.16.3/x86_64-linux/Moose/Util/TypeConstraints.pm The 'add_attribute' method cannot be called on an immutable instance at /home/foobar/perl5/perlbrew/perls/perl-5.16.3/lib/site_perl/5.16.3/x86_64-linux/Moose/Exception.pm line 37 Moose::Exception::_build_trace('Moose::Exception::CallingMethodOnAnImmutableInstance=HASH(0x2886e78)') called at reader Moose::Exception::trace (defined at /home/foobar/perl5/perlbrew/perls/perl-5.16.3/lib/site_perl/5.16.3/x86_64-linux/Moose/Exception.pm line 9) line 7 Moose::Exception::trace('Moose::Exception::CallingMethodOnAnImmutableInstance=HASH(0x2886e78)') called at /home/foobar/perl5/perlbrew/perls/perl-5.16.3/lib/site_perl/5.16.3/x86_64-linux/Moose/Exception.pm line 49 Moose::Exception::BUILD('Moose::Exception::CallingMethodOnAnImmutableInstance=HASH(0x2886e78)', 'HASH(0x2886c20)') called at /home/foobar/perl5/perlbrew/perls/perl-5.16.3/lib/site_perl/5.16.3/x86_64-linux/Class/MOP/Method.pm line 126 Class::MOP::Method::execute('Moose::Meta::Method=HASH(0x2b42920)', 'Moose::Exception::CallingMethodOnAnImmutableInstance=HASH(0x2886e78)', 'HASH(0x2886c20)') called at /home/foobar/perl5/perlbrew/perls/perl-5.16.3/lib/site_perl/5.16.3/x86_64-linux/Moose/Object.pm line 55 Moose::Object::BUILDALL('Moose::Exception::CallingMethodOnAnImmutableInstance=HASH(0x2886e78)', 'HASH(0x2886c20)') called at /home/foobar/perl5/perlbrew/perls/perl-5.16.3/lib/site_perl/5.16.3/x86_64-linux/Moose/Meta/Class.pm line 281 Moose::Meta::Class::new_object('Moose::Meta::Class=HASH(0x2a01cb0)', 'HASH(0x2886c20)') called at /home/foobar/perl5/perlbrew/perls/perl-5.16.3/lib/site_perl/5.16.3/x86_64-linux/Moose/Object.pm line 26 Moose::Object::new('Moose::Exception::CallingMethodOnAnImmutableInstance', 'method_name', 'add_attribute') called at /home/foobar/perl5/perlbrew/perls/perl-5.16.3/lib/site_perl/5.16.3/x86_64-linux/Class/MOP/Class/Immutable/Trait.pm line 94 Class::MOP::Class::Immutable::Trait::__throw_exception('CallingMethodOnAnImmutableInstance', 'method_name', 'add_attribute') called at /home/foobar/perl5/perlbrew/perls/perl-5.16.3/lib/site_perl/5.16.3/x86_64-linux/Class/MOP/Class/Immutable/Trait.pm line 28 Class::MOP::Class::Immutable::Trait::_immutable_cannot_call('add_attribute') called at /home/foobar/perl5/perlbrew/perls/perl-5.16.3/lib/site_perl/5.16.3/x86_64-linux/Class/MOP/Class/Immutable/Trait.pm line 43 Class::MOP::Class:::around('CODE(0x22acf70)', 'Class::MOP::Class::Immutable::Class::MOP::Class=HASH(0x25a2f78)', 'type_constraints', 'accessor', 'type_constraints', 'default', 'CODE(0x25a3500)', 'definition_context', 'HASH(0x28705e8)') called at /home/foobar/perl5/perlbrew/perls/perl-5.16.3/lib/site_perl/5.16.3/x86_64-linux/Class/MOP/Method/Wrapped.pm line 160 Class::MOP::Method::Wrapped::__ANON__('Class::MOP::Class::Immutable::Class::MOP::Class=HASH(0x25a2f78)', 'type_constraints', 'accessor', 'type_constraints', 'default', 'CODE(0x25a3500)', 'definition_context', 'HASH(0x28705e8)') called at /home/foobar/perl5/perlbrew/perls/perl-5.16.3/lib/site_perl/5.16.3/x86_64-linux/Class/MOP/Method/Wrapped.pm line 89 Class::MOP::Class::Immutable::Class::MOP::Class::add_attribute('Class::MOP::Class::Immutable::Class::MOP::Class=HASH(0x25a2f78)', 'type_constraints', 'accessor', 'type_constraints', 'default', 'CODE(0x25a3500)', 'definition_context', 'HASH(0x28705e8)') called at /home/foobar/perl5/perlbrew/perls/perl-5.16.3/lib/site_perl/5.16.3/x86_64-linux/Moose/Meta/TypeConstraint/Union.pm line 20 require Moose/Meta/TypeConstraint/Union.pm at /home/foobar/perl5/perlbrew/perls/perl-5.16.3/lib/site_perl/5.16.3/x86_64-linux/Moose/Util/TypeConstraints.pm line 28 Moose::Util::TypeConstraints::BEGIN at /home/foobar/perl5/perlbrew/perls/perl-5.16.3/lib/site_perl/5.16.3/x86_64-linux/Moose/Meta/TypeConstraint/Union.pm line 0 eval {...} at /home/foobar/perl5/perlbrew/perls/perl-5.16.3/lib/site_perl/5.16.3/x86_64-linux/Moose/Meta/TypeConstraint/Union.pm line 0 Compilation failed in require at /home/foobar/perl5/perlbrew/perls/perl-5.16.3/lib/site_perl/5.16.3/x86_64-linux/Moose/Util/TypeConstraints.pm line 28. BEGIN failed--compilation aborted at /home/foobar/perl5/perlbrew/perls/perl-5.16.3/lib/site_perl/5.16.3/x86_64-linux/Moose/Util/TypeConstraints.pm line 28. While those errors don't cause any kind of trouble when running the program it has been impossible to properly check the syntax inside the editor. I didn't try to reproduce this error from a "vanilla" perl interpreter with Moose installed although. I'm using the following versions: [foobar@localhost ~]$ perl -v This is perl 5, version 16, subversion 3 (v5.16.3) built for x86_64-linux Copyright 1987-2012, Larry Wall Perl may be copied only under the terms of either the Artistic License or the GNU General Public License, which may be found in the Perl 5 source kit. Complete documentation for Perl, including FAQ lists, should be found on this system using "man perl" or "perldoc perl". If you have access to the Internet, point your browser at http://www.perl.org/, the Perl Home Page. [foobar@localhost ~]$ mversion Moose 2.1211
On 2014-08-28 10:47:51, ARFREITAS wrote: Show quoted text
> Hello there, > > These errors are always raised when I try to use Vim + perl-support + > Perlbrew when editing scripts with Moose: > > /home/foobar/perl5/perlbrew/perls/perl-5.16.3/lib/site_perl/5.16.3/x86_64-linux/Moose/Util/TypeConstraints.pm|677| Useless use of private variable in void context > /home/foobar/perl5/perlbrew/perls/perl-5.16.3/lib/site_perl/5.16.3/x86_64-linux/Moose/Util/TypeConstraints.pm|683| Useless use of private variable in void context > /home/foobar/perl5/perlbrew/perls/perl-5.16.3/lib/site_perl/5.16.3/x86_64-linux/Moose/Util/TypeConstraints.pm|704| Useless use of private variable in void context > > Even though the code in TypeConstraings.pm is explicit disabling the > warning: > > sub _parse_parameterized_type_constraint { > { no warnings 'void'; $any; } # force capture of interpolated > lexical > $_[0] =~ m{ $type_capture_parts }x; > return ( $1, $2 ); > }
I'm going to guess that "perl-support", whatever that is (do you have a link?) is using the -W flag to invoke perl, which basically ignores all local warning exemptions in code. "no warnings 'void'" is exactly the right thing to do here, and we can't do anything more than that. Show quoted text
> Checking the syntax from the shell still shows an even more strange > error: > > [foobar@localhost ~]$ perl -cw /home/foobar/perl5/perlbrew/perls/perl-5.16.3/lib/site_perl/5.16.3/x86_64-linux/Moose/Util/TypeConstraints.pm
Not every module in the Moose distribution can be loaded in isolation. Other than for curiosity, why are you trying to do this?
Subject: Re: [rt.cpan.org #98393] Useless use of private variable in void context when checking syntax
Date: Thu, 28 Aug 2014 15:10:57 -0700
To: "bug-Moose [...] rt.cpan.org" <bug-Moose [...] rt.cpan.org>
From: "Alceu R. de Freitas Jr." <glasswalk3r [...] yahoo.com.br>
Hello there, Sorry for not giving a reference, I so used to perlsupport plugin to Vim that sometimes I forgot that not everybody uses it. Here is a link: http://www.vim.org/scripts/script.php?script_id=556 I will look more details how the checking is executed and update here. I think it might be possible that the check is done that way. Regarding checking the TypeConstraints.pm in isolation, I did that only to see if the same error was happening but I understand that some configurations are done dynamically so this should work. Regards, Alceu Em Quinta-feira, 28 de Agosto de 2014 17:49, Karen Etheridge via RT <bug-Moose@rt.cpan.org> escreveu: Show quoted text
> > ><URL: https://rt.cpan.org/Ticket/Display.html?id=98393 > > >On 2014-08-28 10:47:51, ARFREITAS wrote:
>> Hello there, >> >> These errors are always raised when I try to use Vim + perl-support + >> Perlbrew when editing scripts with Moose: >> >> /home/foobar/perl5/perlbrew/perls/perl-5.16.3/lib/site_perl/5.16.3/x86_64-linux/Moose/Util/TypeConstraints.pm|677| Useless use of private variable in void context >> /home/foobar/perl5/perlbrew/perls/perl-5.16.3/lib/site_perl/5.16.3/x86_64-linux/Moose/Util/TypeConstraints.pm|683| Useless use of private variable in void context >> /home/foobar/perl5/perlbrew/perls/perl-5.16.3/lib/site_perl/5.16.3/x86_64-linux/Moose/Util/TypeConstraints.pm|704| Useless use of private variable in void context >> >> Even though the code in TypeConstraings.pm is explicit disabling the >> warning: >> >> sub _parse_parameterized_type_constraint { >> { no warnings 'void'; $any; } # force capture of interpolated >> lexical >> $_[0] =~ m{ $type_capture_parts }x; >> return ( $1, $2 ); >> }
> >I'm going to guess that "perl-support", whatever that is (do you have a link?) >is using the -W flag to invoke perl, which basically ignores all local warning >exemptions in code. "no warnings 'void'" is exactly the right thing to do >here, and we can't do anything more than that. >
>> Checking the syntax from the shell still shows an even more strange >> error: >> >> [foobar@localhost ~]$ perl -cw /home/foobar/perl5/perlbrew/perls/perl-5.16.3/lib/site_perl/5.16.3/x86_64-linux/Moose/Util/TypeConstraints.pm
> >Not every module in the Moose distribution can be loaded in isolation. >Other than for curiosity, why are you trying to do this? > > > > >
Hello Ether, Got this in the perlsupport plugin for Vim: 1008 " Errorformat from compiler/perl.vim (VIM distribution). 1009 " 1010 exe ':set makeprg='.s:Perl_Perl.'\ -cW' 1011 exe ':set errorformat= 1012 \%-G%.%#had\ compilation\ errors., 1013 \%-G%.%#syntax\ OK, 1014 \%m\ at\ %f\ line\ %l., 1015 \%+A%.%#\ at\ %f\ line\ %l\\,%.%#, 1016 \%+C%.%#' 1017 silent exe ':make '. shellescape (l:fullname) Changing the "-cW" to "-cw" avoids the warning was expected. False alarm! I'll submit this change to perlsupport as well. Thank you for the help, Alceu On Thu Aug 28 16:48:57 2014, ETHER wrote: Show quoted text
> > I'm going to guess that "perl-support", whatever that is (do you have > a link?) > is using the -W flag to invoke perl, which basically ignores all local > warning > exemptions in code. "no warnings 'void'" is exactly the right thing > to do > here, and we can't do anything more than that. >
> > Checking the syntax from the shell still shows an even more strange > > error: > > > > [foobar@localhost ~]$ perl -cw > > /home/foobar/perl5/perlbrew/perls/perl- > > 5.16.3/lib/site_perl/5.16.3/x86_64- > > linux/Moose/Util/TypeConstraints.pm
> > Not every module in the Moose distribution can be loaded in isolation. > Other than for curiosity, why are you trying to do this?