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

I keep getting a message that bareword “is_perl55” is not allowed when “strict subs” is used. My simplest example script is just

use WWW::Mechanize;

I’m running ActivePerl (latest version) on 64 bit Windows 10. I was sure that this was working about a week ago and I don’t know what has changed.

The script that I was running was to download the html source from an https web page, but the one-liner above has the same problem

Note: as requested I renamed the thread.

Replies are listed 'Best First'.
Re: Bareword error in WWW::Mechanize
by shmem (Chancellor) on Nov 27, 2017 at 23:41 UTC
    I keep getting a message that bareword “is_perl55” is not allowed when “strict subs” is used.

    You should post the full message. It surely sports a file name and line number. If it doesn't, try

    use Carp; BEGIN { $SIG{__DIE__} = \&Carp::confess; } use WWW::Mechanize;

    which should give you a clue.

    perl -le'print map{pack c,($-++?1:13)+ord}split//,ESEL'
Re: Bareword error in WWW::Mechanize
by Old_Hat (Initiate) on Nov 28, 2017 at 00:27 UTC

    Just to confirm, I'm using "perl 5, version 24, subversion 2 (v5.24.2) built for MSWin32-x64-multi-thread"

    The code at the error in Utils.pm is

    use constant is_perl55 => ($] < 5.005_50); use constant is_perl56 => ($] < 5.007 && $] > 5.005_50); use constant is_sane_perl => $] > 5.007;

    I have browsed the lib files but I don't see where "strict subs" is set. Also, my code was working as of 11/24/17.

    The output from the code you provided is:

    Bareword "is_perl56" not allowed while "strict subs" in use at C:/Perl +64/lib/ExtUtils/Constant/Utils.pm line 51. Bareword "is_perl55" not allowed while "strict subs" in use at C:/Perl +64/lib/ExtUtils/Constant/Utils.pm line 74. Bareword "is_sane_perl" not allowed while "strict subs" in use at C:/P +erl64/lib/ExtUtils/Constant/Utils.pm line 116. Bareword "is_perl55" not allowed while "strict subs" in use at C:/Perl +64/lib/ExtUtils/Constant/Utils.pm line 123. Compilation failed in require at /Perl64/lib/ExtUtils/constant.pm line + 100. ExtUtils::Constant::BEGIN() called at /Perl64/lib/ExtUtils/con +stant.pm line 100 eval {...} called at /Perl64/lib/ExtUtils/constant.pm line 100 require constant.pm called at C:/Perl64/lib/Data/Dumper.pm lin +e 279 Data::Dumper::BEGIN() called at /Perl64/lib/ExtUtils/constant. +pm line 100 eval {...} called at /Perl64/lib/ExtUtils/constant.pm line 100 require Data/Dumper.pm called at /Perl64/lib/ExtUtils/Config.p +m line 6 ExtUtils::Config::BEGIN() called at /Perl64/lib/ExtUtils/const +ant.pm line 100 eval {...} called at /Perl64/lib/ExtUtils/constant.pm line 100 require Config.pm called at C:/Perl64/lib/Tie/RefHash.pm line +104 Tie::RefHash::BEGIN() called at /Perl64/lib/ExtUtils/constant. +pm line 100 eval {...} called at /Perl64/lib/ExtUtils/constant.pm line 100 require Tie/RefHash.pm called at C:/Perl64/lib/WWW/Mechanize.p +m line 11 WWW::Mechanize::BEGIN() called at /Perl64/lib/ExtUtils/constan +t.pm line 100 eval {...} called at /Perl64/lib/ExtUtils/constant.pm line 100 require WWW/Mechanize.pm called at test.pl line 5 main::BEGIN() called at /Perl64/lib/ExtUtils/constant.pm line +100 eval {...} called at /Perl64/lib/ExtUtils/constant.pm line 100 BEGIN failed--compilation aborted at /Perl64/lib/ExtUtils/constant.pm +line 100. at /Perl64/lib/ExtUtils/constant.pm line 100. require constant.pm called at C:/Perl64/lib/Data/Dumper.pm lin +e 279 Data::Dumper::BEGIN() called at /Perl64/lib/ExtUtils/constant. +pm line 100 eval {...} called at /Perl64/lib/ExtUtils/constant.pm line 100 require Data/Dumper.pm called at /Perl64/lib/ExtUtils/Config.p +m line 6 ExtUtils::Config::BEGIN() called at /Perl64/lib/ExtUtils/const +ant.pm line 100 eval {...} called at /Perl64/lib/ExtUtils/constant.pm line 100 require Config.pm called at C:/Perl64/lib/Tie/RefHash.pm line +104 Tie::RefHash::BEGIN() called at /Perl64/lib/ExtUtils/constant. +pm line 100 eval {...} called at /Perl64/lib/ExtUtils/constant.pm line 100 require Tie/RefHash.pm called at C:/Perl64/lib/WWW/Mechanize.p +m line 11 WWW::Mechanize::BEGIN() called at /Perl64/lib/ExtUtils/constan +t.pm line 100 eval {...} called at /Perl64/lib/ExtUtils/constant.pm line 100 require WWW/Mechanize.pm called at test.pl line 5 main::BEGIN() called at /Perl64/lib/ExtUtils/constant.pm line +100 eval {...} called at /Perl64/lib/ExtUtils/constant.pm line 100 Compilation failed in require at C:/Perl64/lib/Data/Dumper.pm line 279 +. at C:/Perl64/lib/Data/Dumper.pm line 279. Data::Dumper::BEGIN() called at C:/Perl64/lib/Data/Dumper.pm l +ine 279 eval {...} called at C:/Perl64/lib/Data/Dumper.pm line 279 require Data/Dumper.pm called at /Perl64/lib/ExtUtils/Config.p +m line 6 ExtUtils::Config::BEGIN() called at C:/Perl64/lib/Data/Dumper. +pm line 279 eval {...} called at C:/Perl64/lib/Data/Dumper.pm line 279 require Config.pm called at C:/Perl64/lib/Tie/RefHash.pm line +104 Tie::RefHash::BEGIN() called at C:/Perl64/lib/Data/Dumper.pm l +ine 279 eval {...} called at C:/Perl64/lib/Data/Dumper.pm line 279 require Tie/RefHash.pm called at C:/Perl64/lib/WWW/Mechanize.p +m line 11 WWW::Mechanize::BEGIN() called at C:/Perl64/lib/Data/Dumper.pm + line 279 eval {...} called at C:/Perl64/lib/Data/Dumper.pm line 279 require WWW/Mechanize.pm called at test.pl line 5 main::BEGIN() called at C:/Perl64/lib/Data/Dumper.pm line 279 eval {...} called at C:/Perl64/lib/Data/Dumper.pm line 279 BEGIN failed--compilation aborted at C:/Perl64/lib/Data/Dumper.pm line + 279. at C:/Perl64/lib/Data/Dumper.pm line 279. require Data/Dumper.pm called at /Perl64/lib/ExtUtils/Config.p +m line 6 ExtUtils::Config::BEGIN() called at C:/Perl64/lib/Data/Dumper. +pm line 279 eval {...} called at C:/Perl64/lib/Data/Dumper.pm line 279 require Config.pm called at C:/Perl64/lib/Tie/RefHash.pm line +104 Tie::RefHash::BEGIN() called at C:/Perl64/lib/Data/Dumper.pm l +ine 279 eval {...} called at C:/Perl64/lib/Data/Dumper.pm line 279 require Tie/RefHash.pm called at C:/Perl64/lib/WWW/Mechanize.p +m line 11 WWW::Mechanize::BEGIN() called at C:/Perl64/lib/Data/Dumper.pm + line 279 eval {...} called at C:/Perl64/lib/Data/Dumper.pm line 279 require WWW/Mechanize.pm called at test.pl line 5 main::BEGIN() called at C:/Perl64/lib/Data/Dumper.pm line 279 eval {...} called at C:/Perl64/lib/Data/Dumper.pm line 279 Compilation failed in require at /Perl64/lib/ExtUtils/Config.pm line 6 +. at /Perl64/lib/ExtUtils/Config.pm line 6. ExtUtils::Config::BEGIN() called at /Perl64/lib/ExtUtils/Confi +g.pm line 6 eval {...} called at /Perl64/lib/ExtUtils/Config.pm line 6 require Config.pm called at C:/Perl64/lib/Tie/RefHash.pm line +104 Tie::RefHash::BEGIN() called at /Perl64/lib/ExtUtils/Config.pm + line 6 eval {...} called at /Perl64/lib/ExtUtils/Config.pm line 6 require Tie/RefHash.pm called at C:/Perl64/lib/WWW/Mechanize.p +m line 11 WWW::Mechanize::BEGIN() called at /Perl64/lib/ExtUtils/Config. +pm line 6 eval {...} called at /Perl64/lib/ExtUtils/Config.pm line 6 require WWW/Mechanize.pm called at test.pl line 5 main::BEGIN() called at /Perl64/lib/ExtUtils/Config.pm line 6 eval {...} called at /Perl64/lib/ExtUtils/Config.pm line 6 BEGIN failed--compilation aborted at /Perl64/lib/ExtUtils/Config.pm li +ne 6. at /Perl64/lib/ExtUtils/Config.pm line 6. require Config.pm called at C:/Perl64/lib/Tie/RefHash.pm line +104 Tie::RefHash::BEGIN() called at /Perl64/lib/ExtUtils/Config.pm + line 6 eval {...} called at /Perl64/lib/ExtUtils/Config.pm line 6 require Tie/RefHash.pm called at C:/Perl64/lib/WWW/Mechanize.p +m line 11 WWW::Mechanize::BEGIN() called at /Perl64/lib/ExtUtils/Config. +pm line 6 eval {...} called at /Perl64/lib/ExtUtils/Config.pm line 6 require WWW/Mechanize.pm called at test.pl line 5 main::BEGIN() called at /Perl64/lib/ExtUtils/Config.pm line 6 eval {...} called at /Perl64/lib/ExtUtils/Config.pm line 6 Compilation failed in require at C:/Perl64/lib/Tie/RefHash.pm line 104 +. at C:/Perl64/lib/Tie/RefHash.pm line 104. Tie::RefHash::BEGIN() called at C:/Perl64/lib/Tie/RefHash.pm l +ine 104 eval {...} called at C:/Perl64/lib/Tie/RefHash.pm line 104 require Tie/RefHash.pm called at C:/Perl64/lib/WWW/Mechanize.p +m line 11 WWW::Mechanize::BEGIN() called at C:/Perl64/lib/Tie/RefHash.pm + line 104 eval {...} called at C:/Perl64/lib/Tie/RefHash.pm line 104 require WWW/Mechanize.pm called at test.pl line 5 main::BEGIN() called at C:/Perl64/lib/Tie/RefHash.pm line 104 eval {...} called at C:/Perl64/lib/Tie/RefHash.pm line 104 BEGIN failed--compilation aborted at C:/Perl64/lib/Tie/RefHash.pm line + 104. at C:/Perl64/lib/Tie/RefHash.pm line 104. require Tie/RefHash.pm called at C:/Perl64/lib/WWW/Mechanize.p +m line 11 WWW::Mechanize::BEGIN() called at C:/Perl64/lib/Tie/RefHash.pm + line 104 eval {...} called at C:/Perl64/lib/Tie/RefHash.pm line 104 require WWW/Mechanize.pm called at test.pl line 5 main::BEGIN() called at C:/Perl64/lib/Tie/RefHash.pm line 104 eval {...} called at C:/Perl64/lib/Tie/RefHash.pm line 104 Compilation failed in require at C:/Perl64/lib/WWW/Mechanize.pm line 1 +1. at C:/Perl64/lib/WWW/Mechanize.pm line 11. WWW::Mechanize::BEGIN() called at C:/Perl64/lib/WWW/Mechanize. +pm line 11 eval {...} called at C:/Perl64/lib/WWW/Mechanize.pm line 11 require WWW/Mechanize.pm called at test.pl line 5 main::BEGIN() called at C:/Perl64/lib/WWW/Mechanize.pm line 11 eval {...} called at C:/Perl64/lib/WWW/Mechanize.pm line 11 BEGIN failed--compilation aborted at C:/Perl64/lib/WWW/Mechanize.pm li +ne 11. at C:/Perl64/lib/WWW/Mechanize.pm line 11. require WWW/Mechanize.pm called at test.pl line 5 main::BEGIN() called at C:/Perl64/lib/WWW/Mechanize.pm line 11 eval {...} called at C:/Perl64/lib/WWW/Mechanize.pm line 11 Compilation failed in require at test.pl line 5. at test.pl line 5. main::BEGIN() called at test.pl line 5 eval {...} called at test.pl line 5 BEGIN failed--compilation aborted at test.pl line 5. at test.pl line 5
      use constant is_perl55 => ($] < 5.005_50); use constant is_perl56 => ($] < 5.007 && $] > 5.005_50); use constant is_sane_perl => $] > 5.007;

      Weird. The "fat comma" ("=>") quotes its left hand side, so strict shouldn't complain. Looks like your perl is broken. Did your Win10 do any updates lately? Carefully check C:/Perl64/lib/ExtUtils/Constant/Utils.pm for any weirdness, and you could move the original file out of the way, make a copy and quote the LHS of the arguments to use, e.g.

      use constant 'is_perl55' => ($] < 5.005_50); use constant 'is_perl56' => ($] < 5.007 && $] > 5.005_50); use constant 'is_sane_perl' => $] > 5.007;

      If that fixes the issue, it is time to file a bug report to ActiveState.

      perl -le'print map{pack c,($-++?1:13)+ord}split//,ESEL'

        I tried quoting as you suggested and it fixed this instance. From there the same condition (and fix) continued in other modules until I gave up. I reinstalled ActivePerl and the problem did not go away.

        Any ideas to try? Or should I contact ActivePerl?

        The last windows update was two weeks prior to the problem, so I don’t think that is an issue.

        Do you think It is worth trying the 32-bit version?

        Not enough info provided to conclude anything other than more info is need, version info as provided by Devel::Modlist
      Perl64/lib/ExtUtils/constant.pm line 100

      There is ExtUtils::Constant to import C header constants via XS, but I can't see lowercase constant anywhere in the ExtUtils namespace.

      ($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,

        Windows treats Constant.pm as being the same file as constant.pm, that is, you can't have both at the same time in the same directory.

        Renaming Constant.pm to constant.pm changes nothing. In both cases the error references the lowercase file.