Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there any problem with "use diagnostics;"?

Tags:

perl

With perl I almost always use:

use strict;
use diagnostics;

I suggested "use diagnostics" instead of use warnings; here and I received some negative feedback. So, now I'm thinking:

Is there any problem with use diagnostics;?

like image 474
cirne100 Avatar asked Jun 18 '11 15:06

cirne100


1 Answers

diagnostics isn't a lexical pragma like warnings. Instead it sets the global $^W variable (like using the -w flag), which enables warnings for all code, whether it wants it or not, and whether you wrote it or not. That's kind of rude. diagnostics is also silly to use in production. I would recommend using warnings and then just piping your warnings to splain if you need an explanation.

like image 168
hobbs Avatar answered Oct 18 '22 22:10

hobbs