Enable global alerts

I need to optimize an intranet written in Perl (about 3,000 files). The first thing I want to do is turn on the warnings " -w" or " use warnings;" so that I can get rid of all these errors, and then try to implement " use strict;".

Is there any way to tell Perl to use warnings all the time (for example, settings in php.inifor PHP), without having to change each script to add "-w" to the first line?

I even thought of making an alias for /usr/bin/perlor moving it to another name and making a simple script instead, just add a flag -w(for example, a proxy).

How do you debug it?

+3
source share
3 answers

Retrofit warnings and severe difficulty. I do not recommend the Big Bang approach, setting warnings (not to mention restrictions) on everything. You will be inundated with warnings to no avail.

You start by turning on warnings about the modules used by scripts (there are some, they are not), instead of applying warnings to everything. Get the purity of the core, and then work on the periphery, one unit at a time. In fact, I would recommend having a simple (Perl) script that just finds a line that does not start with a hash, and adds use warnings;(and possibly use strict;also since you are going to deal with one script at a time), so you can do updates once a script at a time.

, , , , .

"", : . , , "", "".

, , . Perl script, . fix* bin, - , (, , ) , .

+9

...

PERL5OPT envariable -w. . perlrun manpage. , tainting, -T , , -T, .

. , use warnings use strict, PITA.

- . Perl. CGI, , , - .

+12

Perl, -Mwarnings -Mstrict PERL5OPT. . perlrun.

+5

Source: https://habr.com/ru/post/1786151/


All Articles