ssimms / pdfapi2

Create, modify, and examine PDF files in Perl
Other
15 stars 21 forks source link

Shouldn't PDF::API2 enable warnings? #57

Closed sciurius closed 2 years ago

sciurius commented 2 years ago

At the start of PDF::API2:

package PDF::API2;

use strict;
no warnings qw[ deprecated recursion uninitialized ];

Certain warnings are disabled, but warnings are not enabled. Did the line use warnings; got lost?

ssimms commented 2 years ago

It didn't get lost -- this was a previous author's approach to preventing warnings from getting printed. I think it was meant to read as "don't print any warnings, ever, of any kind, especially these."

I've been enabling warnings in the various modules as I've been updating the code. As of the last time I checked, though, the root PDF::API2 module still has a fair bit of code that assumes that Perl won't complain about uninitialized/undefined values.

sciurius commented 2 years ago

I think it is okay to disable warnings about uninitialized/undefined values. But disabling all warnings seems a bit overkill and incorrect. FWIW, I've added a use warnings before the no warnings and my tests do not throw up warnings. Well, except for one warning that pointed out a programming error (of mine) that would otherwise have been very hard to find.