in reply to Misspelled subroutine name -- no way to catch it at compile time? C'mon.

> (Edited 2024-12-16 at 13:39 ET, to specify the desired behavior, as suggested in a comment: I'd like to be able to have an error produced at compile time rather than at run time.)

Like I already updated, you can drop the parentheses (and &-sigils if any) to enforce compile time checking.

FWIW: If you want this to happen with parentheses too, it's theoretically possible to write a module/pragma parsing the OP tree at the CHECK or UNITCHECK phase to abort compilation in case of absent subs in the namespaces. (See perlmod for phases)

I think I know how to implement this particular feature, but that's none of my itches to scratch. 🤷🏻‍♂️

Maybe worth checking CPAN before reinventing the wheel 🛞 (I haven't)

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

  • Comment on Re: Misspelled subroutine name -- no way to catch it at compile time? C'mon.