in reply to Re: How to identify incorrect subroutine calls in a perl program
in thread How to identify incorrect subroutine calls in a perl program

>perl -c -we "use strict; Log('There is an issue')" -e syntax OK

What complaint about a bareword?

  • Comment on Re^2: How to identify incorrect subroutine calls in a perl program
  • Download Code

Replies are listed 'Best First'.
Re^3: How to identify incorrect subroutine calls in a perl program
by LanX (Saint) on Dec 16, 2024 at 17:54 UTC

    Calls without parens need to go to pre declared subs, hence a compile time error.

    perl -c -we" use strict; Log 'There is an issue'" String found where operator expected at -e line 1, near "Log 'There is + an issue'" (Do you need to predeclare Log?)

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    see Wikisyntax for the Monastery

      I fail to see how that's relevant.

      dragonchild said that importing would result in a compile-time error. That would only detect a typo in the previously-non-existent import. It wouldn't identify incorrect calls at compile-time.

      dragonchild didn't suggest omitting the parens. dragonchild even used parens in their post, just like the OP. Hence no compile-time errors would have resulted from their suggestion.

      Finally, omitting parens wouldn't even have worked well at the time of the post. For best results, use v5.28;/no feature qw( indirect );/no indirect; is required, but the post predates these.