Post without Account — your post will be reviewed, and if appropriate, posted under Anonymous. You can also use this link to report any problems registering or logging in.

CTS 15 - use strict; and use warnings; in all modules?

  • 1 Replies
  • 1439 Views
*

Offline Phil

  • Global Moderator
  • Hero Member
  • *****
  • 601
    • View Profile
CTS 15 - use strict; and use warnings; in all modules?
« December 25, 2017, 02:17:58 PM »
(from PDF::API2 pull request)

paultcochrane commented on Sep 29, 2016

Using the warnings pragma is considered best practice. By adding the warnings pragma to all files did not cause new warnings to appear in the test output. This change fixes the use_warnings kwalitee test on CPANTS. This PR is submitted in the hope that it is helpful. If it can be improved upon in any way, please simply let me know and I'll update and resubmit it.

<Request is to make sure all .pm files include use warnings;, even if they already have a no warnings list statement. Also, all .pm files should have use strict; to ensure full language compliance. -- Mod.>

ssimms commented on Oct 7, 2016

This one makes me nervous since the test coverage is pretty low. A previous maintainer took the approach of adding "no warnings" to every file, which I've been gradually undoing as I've been updating the code.

Maybe the best way forward is to do a dev release with "use warnings" throughout and see what it does to my production servers. :-)

paultcochrane commented on Oct 8, 2016

Yes, you're right. Either I'd switched off my brain while making this PR or it was late and I was tired... use strict picks things up at compile time, hence the all-usable test will show up those issues, however use warnings only has an effect if the code is run, and hence needs test coverage. If this change is too risky, I don't have a problem if you decide to close it unmerged.

<So, it sounds like use strict; and use warnings; should be inserted into code and run for a while before releasing to the general public? -- Mod.>
« Last Edit: May 12, 2019, 08:05:29 PM by Phil »

*

Offline Phil

  • Global Moderator
  • Hero Member
  • *****
  • 601
    • View Profile
Re: CTS 15 - use strict; and use warnings; in all modules?
« Reply #1: September 09, 2018, 05:54:18 PM »
perlcritic at level 4 does a lot of bellyaching about "no warnings" usage. Anything done about warnings and strictness should take care to test against perlcritic to see if its complaints are addressed.
« Last Edit: May 12, 2019, 08:05:59 PM by Phil »