Retrieving perl -w tag results in a file

Is it possible to add the -w tag to the first line of the perl program, and then run the program from a shell such as bash or dos and write all warnings to a file?

perl somescript.pl > somefile.txt

This is a return to checking COBOL programs at school. I would like all the warnings in front of me on a piece of paper so that I can go through my program and fix them one by one. If the above command does not work, is there a way to programmatically get all script warnings in a file? Thanks guys!

+3
source share
2 answers

Try the following:

perl somescript.pl 2&> somefile.txt

(>) , . ., , Bash .

CPAN Vi::QuickFix, , Vim, . (Google vim quickfix.) .

+4

zoul , .

: perl -w script.pl

, script . , . . perldoc perllexwarn .

, , Carp:: Always. . . script :

perl -MCarp::Always somescript.pl

:

perl -MCarp::Always somescript.pl 2&> somefile.txt

, , . , , ​​ Log4Perl. (, ) . (?) . , .

+1

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


All Articles