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

I'm trying to run the Devel::Cover module on a testing tool. I get the following error:
unexpected OP_RKEYS at /usr/pkgs/perl/5.14.1/lib64/5.14.1/B/Deparse.pm + line 1113. unexpected OP_RKEYS at /usr/pkgs/perl/5.14.1/lib64/5.14.1/B/Deparse.pm + line 1113. unexpected OP_RKEYS at /usr/pkgs/perl/5.14.1/lib64/5.14.1/B/Deparse.pm + line 1113. unexpected OP_RKEYS at /usr/pkgs/perl/5.14.1/lib64/5.14.1/B/Deparse.pm + line 1113. Possible unintended interpolation of @runs in string at /usr/pkgs/per +l/5.14.1/lib64/5.14.1/Devel--Cover-master/lib/Devel/Cover/DB.pm line +808. Possible unintended interpolation of @runs in string at /usr/pkgs/per +l/5.14.1/lib64/5.14.1/Devel--Cover-master/lib/Devel/Cover/DB.pm line +808. Bareword found where operator expected at /usr/pkgs/perl/5.14.1/lib64 +/5.14.1/Devel--Cover-master/lib/Devel/Cover/DB.pm line 836, near "$fi +le =~ q|/Devel" (Might be a runaway multi-line // string starting on line 808) Global symbol "@runs" requires explicit package name at /usr/pkgs/per +l/5.14.1/lib64/5.14.1/Devel--Cover-master/lib/Devel/Cover/DB.pm line +808. Global symbol "$run" requires explicit package name at /usr/pkgs/perl +/5.14.1/lib64/5.14.1/Devel--Cover-master/lib/Devel/Cover/DB.pm line 8 +08. Global symbol "@runs" requires explicit package name at /usr/pkgs/per +l/5.14.1/lib64/5.14.1/Devel--Cover-master/lib/Devel/Cover/DB.pm line +808. Global symbol "$st" requires explicit package name at /usr/pkgs/perl/ +5.14.1/lib64/5.14.1/Devel--Cover-master/lib/Devel/Cover/DB.pm line 80 +8. Global symbol "$r" requires explicit package name at /usr/pkgs/perl/5 +.14.1/lib64/5.14.1/Devel--Cover-master/lib/Devel/Cover/DB.pm line 808 +. Global symbol "$run" requires explicit package name at /usr/pkgs/perl +/5.14.1/lib64/5.14.1/Devel--Cover-master/lib/Devel/Cover/DB.pm line 8 +08. Global symbol "$r" requires explicit package name at /usr/pkgs/perl/5 +.14.1/lib64/5.14.1/Devel--Cover-master/lib/Devel/Cover/DB.pm line 808 +. Global symbol "$r" requires explicit package name at /usr/pkgs/perl/5 +.14.1/lib64/5.14.1/Devel--Cover-master/lib/Devel/Cover/DB.pm line 808 +. Global symbol "$st" requires explicit package name at /usr/pkgs/perl/ +5.14.1/lib64/5.14.1/Devel--Cover-master/lib/Devel/Cover/DB.pm line 80 +8. Global symbol "$r" requires explicit package name at /usr/pkgs/perl/5 +.14.1/lib64/5.14.1/Devel--Cover-master/lib/Devel/Cover/DB.pm line 808 +. Global symbol "$count" requires explicit package name at /usr/pkgs/pe +rl/5.14.1/lib64/5.14.1/Devel--Cover-master/lib/Devel/Cover/DB.pm line + 808. Global symbol "$r" requires explicit package name at /usr/pkgs/perl/5 +.14.1/lib64/5.14.1/Devel--Cover-master/lib/Devel/Cover/DB.pm line 808 +. Global symbol "$run" requires explicit package name at /usr/pkgs/perl +/5.14.1/lib64/5.14.1/Devel--Cover-master/lib/Devel/Cover/DB.pm line 8 +08. Global symbol "$count" requires explicit package name at /usr/pkgs/pe +rl/5.14.1/lib64/5.14.1/Devel--Cover-master/lib/Devel/Cover/DB.pm line + 808. Global symbol "$file" requires explicit package name at /usr/pkgs/per +l/5.14.1/lib64/5.14.1/Devel--Cover-master/lib/Devel/Cover/DB.pm line +808. Global symbol "$f" requires explicit package name at /usr/pkgs/perl/5 +.14.1/lib64/5.14.1/Devel--Cover-master/lib/Devel/Cover/DB.pm line 808 +. Global symbol "$count" requires explicit package name at /usr/pkgs/pe +rl/5.14.1/lib64/5.14.1/Devel--Cover-master/lib/Devel/Cover/DB.pm line + 808. Global symbol "$digest" requires explicit package name at /usr/pkgs/p +erl/5.14.1/lib64/5.14.1/Devel--Cover-master/lib/Devel/Cover/DB.pm lin +e 808. Global symbol "$r" requires explicit package name at /usr/pkgs/perl/5 +.14.1/lib64/5.14.1/Devel--Cover-master/lib/Devel/Cover/DB.pm line 808 +. Global symbol "$file" requires explicit package name at /usr/pkgs/per +l/5.14.1/lib64/5.14.1/Devel--Cover-master/lib/Devel/Cover/DB.pm line +808. Global symbol "$digest" requires explicit package name at /usr/pkgs/p +erl/5.14.1/lib64/5.14.1/Devel--Cover-master/lib/Devel/Cover/DB.pm lin +e 808. Global symbol "$file" requires explicit package name at /usr/pkgs/per +l/5.14.1/lib64/5.14.1/Devel--Cover-master/lib/Devel/Cover/DB.pm line +808. Global symbol "$file" requires explicit package name at /usr/pkgs/per +l/5.14.1/lib64/5.14.1/Devel--Cover-master/lib/Devel/Cover/DB.pm line +808. Global symbol "$file" requires explicit package name at /usr/pkgs/per +l/5.14.1/lib64/5.14.1/Devel--Cover-master/lib/Devel/Cover/DB.pm line +808. /usr/pkgs/perl/5.14.1/lib64/5.14.1/Devel--Cover-master/lib/Devel/Cove +r/DB.pm has too many errors. Compilation failed in require at /usr/pkgs/perl/5.14.1/lib64/5.14.1/D +evel--Cover-master/lib/Devel/Cover.pm line 21. BEGIN failed--compilation aborted at /usr/pkgs/perl/5.14.1/lib64/5.14 +.1/Devel--Cover-master/lib/Devel/Cover.pm line 21. Compilation failed in require. BEGIN failed--compilation aborted.
I guess it has to do with the following comment:
# Sometimes the start value is undefined. It's not yet clear why, + but it # probably has something to do with the code under test forking. +We'll # just try to cope with that here.
From the module (link: https://github.com/pjcj/Devel--Cover/commit/39ee220b1c04c442e1ab9077fea7309e2ebc9769). Have someone already had this issue and knows how to solve it?

Replies are listed 'Best First'.
Re: Error in coverage module
by AnomalousMonk (Archbishop) on Oct 15, 2019 at 21:27 UTC
    (Might be a runaway multi-line // string starting on line 808)

    Yes, reading the error message can be helpful. I cannot duplicate the "runaway" suggestion from the command line, but the problem with

    c:\@Work\Perl\monks>perl -wMstrict -le "my $file = '/Devel'; print 'hi' if 'xhix' =~ /hi; print 'ho'; print 'he' if $file =~ q|/Devel|; " Bareword found where operator expected at -e line 1, near "Devel" (Missing operator before Devel?) syntax error at -e line 1, near "Devel" Execution of -e aborted due to compilation errors.
    is clearly due to a runaway  // in a previous statement.

    BTW: Use of a string with a  =~ binding operator is kosher

    c:\@Work\Perl\monks>perl -wMstrict -le "my $file = 'foo/Devel/bar'; print 'match' if $file =~ q|/Devel/|; " match
    if the quoted string is properly delimited!


    Give a man a fish:  <%-{-{-{-<

      Hm, thanks, did not know about $foo =~ q/oo/ ... but why would you use q instead of m?


      The way forward always starts with a minimal test.

        In something like
            print 'match' if $file =~ q|/Devel/|;
        I'd be inclined to use  qr|/Devel/| or better yet  qr{ /Devel/ }xms (for various arcane reasons), or m//. But it may sometimes be useful to match directly against a string, either as a literal (but this seems rather quirky to me) or in a variable; as an example of the latter:
            my $string = <$filehandle>;
            ...
            do_something() if $something_else =~ $string;
        (Of course, matching against a string read from an external source may have issues with metacharacter quoting, sanitization, etc.)


        Give a man a fish:  <%-{-{-{-<

      So what should I change in the code in order to make it work? Why it happens?

        I'm not familiar with the module in question and I don't have time ATM to look into the matter, but why not look at or near line 808 for a "runaway multi-line // string" problem like the one illustrated here. A lot of errors seem to be associated with line 808.


        Give a man a fish:  <%-{-{-{-<

Re: Error in coverage module
by 1nickt (Canon) on Oct 15, 2019 at 17:10 UTC

    Did you read the error output carefully?

    "$file =~ q|/Devel"

    I guess you want:

    $file =~ m|/Devel

    Edit: nope that's not the fix, thx AnomalousMonk

    Hope this helps!


    The way forward always starts with a minimal test.