|The stupid question is the question not asked|
Error reporting in Function::Parametersby golux (Chaplain)
|on May 31, 2018 at 18:08 UTC||Need Help??|
golux has asked for the wisdom of the Perl Monks concerning the following question:
After getting tired of Method::Signatures often reporting the wrong error line, I turned to Function::Parameters, having read somewhere that it didn't have this problem. However, the issues I'm having with Function::Parameters are often worse. When used in conjunction with Moo, the first line where the error occurs is often reported after numerous other lines are reported first, making the root cause hard to find.
Worse, the error reported may have nothing to do with the actual error!
Consider the following module "Thing.pm":
Running perl -c Thing.pm produces (at least for me) this error:
This error seems meaningless as it's not even in the method loop() where the error (the typo "nnext") actually occurs.
If the method getcwd() is changed to:
suddenly the error is correctly reported:
Note that my original module is almost 2,000 lines, and the error not at all obvious until I started making random changes to try to get Function::Parameters to reveal it.
Does anyone know why this would be the case? Should I be using a different module for type signatures (besides Method::Signatures and Function Parameters)? Or is there some workaround I'm unaware of?