nysus has asked for the wisdom of the Perl Monks concerning the following question:

I'm seeing some odd behavior when I use the \rs hotkey combination to compile my perl script from within vim (non-gui) version. I have this simple code:

#!/usr/bin/perl use WWW::Mechanize; use Moose;

When I compile it within vim, I get void context errors:

1 /usr/share/perl5/WWW/Mechanize.pm|2545| Useless use of join or strin +g in void context 2 /usr/lib/x86_64-linux-gnu/perl5/5.20/Moose/Util/TypeConstraints.pm|6 +74| Useless use of private variable in void context 3 /usr/lib/x86_64-linux-gnu/perl5/5.20/Moose/Util/TypeConstraints.pm|6 +80| Useless use of private variable in void context 4 /usr/lib/x86_64-linux-gnu/perl5/5.20/Moose/Util/TypeConstraints.pm|6 +85| Useless use of private variable in void context 5 /usr/lib/x86_64-linux-gnu/perl5/5.20/Moose/Util/TypeConstraints.pm|6 +99| Useless use of private variable in void context

However, when I run perl -c <file> from the command line, I don't get any void context errors. What might explain this behavior and how to I fix it without resorting to throwing no warnings;...use warnings; around the use <package> statements?

Update: Actually, throwing no warnings;...use warnings; around the use <package> statements doesn't make the warnings go away. So I'm not even sure how to suppress them at all now. I'm using perl v 5.20.2

$PM = "Perl Monk's";
$MCF = "Most Clueless Friar Abbot Bishop Pontiff Deacon Curate";
$nysus = $PM . ' ' . $MCF;
Click here if you love Perl Monks

  • Comment on SOLVED: How to get rid of "void context" warnings when using vim's perl-support plugin
  • Select or Download Code

Replies are listed 'Best First'.
Re: How to get rid of "void context" warnings when using vim's perl-support plugin
by nysus (Parson) on Apr 16, 2016 at 11:33 UTC

    SOLVED

    Thanks to discussion here.

    Solution: Look for the following line:

    exe ':set makeprg='.s:Perl_Perl.'\ -cW'

    in the perl-support.vim file and change the upper case "W" to a lower case "w".

    $PM = "Perl Monk's";
    $MCF = "Most Clueless Friar Abbot Bishop Pontiff Deacon Curate";
    $nysus = $PM . ' ' . $MCF;
    Click here if you love Perl Monks