top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

How to Turn On and Off Perl warnings ?

+1 vote
610 views

Why it is important to turn it on ? I want to make it off.

posted May 8, 2014 by Yogeshwar Thakur

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

Why it is important to turn it on ?
Perl is very forgiving of strange and sometimes wrong code, which can mean hours spent searching for bugs and weird results. Turning on warnings helps uncover common mistakes and strange places and save a lot of debugging time in the long run.

There are various ways of turning on Perl warnings:
For Perl one-liner, use -w option on the command line.
On Unix or Windows, use the -w option in the shebang line (The first # line in the script). Note: Windows Perl interpreter may not require it.
For other systems, choose compiler warnings, or check compiler documentation.

You can turn it off with following keyword. Will give you an example.
To explicitly turn off a "FATAL" warning you just disable the warning it is associated with. So, for example, to disable the "void" warning in the example above, either of these will do the trick:

no warnings qw(void);
no warnings FATAL => qw(void);
answer May 9, 2014 by Karan Joglekar
Similar Questions
0 votes

since I'm pretty new to Perl 6, is this book
http://shop.oreilly.com/product/9780596007379.do outdated or is it
worth reading? I ask because the book has been published in 2004, so I guess Perl 6 development has gone miles away now.

+1 vote

I need to access ClearQuest programatically using Perl. I just found ClearQuest OSLC REST API. Client is planning to use ClearQuest web 7.1.1. I read that it comes with OSLC REST API out the box.
Can someone please provide me some examples on how I can access the CQ through Perl using this API.

+1 vote

I have a Linux machine and windows machine, I need to run a GUI of Linux machine on the windows machine.
I don't want to use putty or any other software. I have to use any Perl modules to achieve this please help.

...