Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Disabling Specific Warnings

by RollyGuy (Chaplain)
on Sep 11, 2002 at 14:21 UTC ( [id://196944]=perlquestion: print w/replies, xml ) Need Help??

RollyGuy has asked for the wisdom of the Perl Monks concerning the following question:

I have a 64-bit perl that likes to give warnings (I'm doing a use warnings;) that greater than 32bit numbers are non-portable every time I have one typed in. I realize that they are not portable and would like to disable this specific warning, but am unsure how to do it. I've looked into "no warnings;", but it's too broad. I suppose I'll have to use: no warnings "X"; where X is the string I need to find. How do I go about solving this?

Replies are listed 'Best First'.
Re: Disabling Specific Warnings
by Zaxo (Archbishop) on Sep 11, 2002 at 14:29 UTC
    no warnings 'portable';

    See warnings for more information.

    After Compline,
    Zaxo

Re: Disabling Specific Warnings
by Joost (Canon) on Sep 11, 2002 at 14:32 UTC
    I've not got a 64-bit perl laying around, but a look at perllexwarn for 5.8.0 pointed me to the "portable" category, so that this might work:

    use warnings; no warnings "portable";

    If it doesn't help, there might be some other category you can try in perllexwarn.

    -- Joost downtime n. The period during which a system is error-free and immune from user input.
Re: Disabling Specific Warnings
by Aristotle (Chancellor) on Sep 11, 2002 at 14:36 UTC
    perldoc -f perllexwarn should help some; at least it contains all the warning classes you can enable/disable. Which one this would be for you I have no idea, but given this starting point you should be able to find out. Update: oy vey, took me too long to write this it seems.

    Makeshifts last the longest.

Re: Disabling Specific Warnings
by Juerd (Abbot) on Sep 11, 2002 at 14:30 UTC

    $SIG{__WARN__} = sub { warn $_[0] unless $_[0] =~ /portable/ };
    (Note: "no warnings 'portable';" is better, but does not work when the warnings pragma is not available.)

    - Yes, I reinvent wheels.
    - Spam: Visit eurotraQ.
    

      Preventing that sort of constructs is ofcourse why warnings was invented in the first place.
      -- Joost downtime n. The period during which a system is error-free and immune from user input.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://196944]
Approved by Aristotle
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (1)
As of 2024-04-25 05:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found