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

I'm running Perl 5.6.0 on Linux and am getting warnings in my browser when I run my Perl programs:

Use of uninitialized value in exec at /usr/lib/perl5/site_perl/5.6.0/Mail/Mailer/sendmail.pm line 16.

I placed the following code in my Perl program, but it does not seem to affect external modules such as sendmail...

no warnings qw(all);

The above code does work for the code immediately in my programs.

Does anyone know if there is a global configuration to turn off these warnings (i.e. outside of a single perl program)?

Replies are listed 'Best First'.
Re: Receiving warnings in browser
by PodMaster (Abbot) on Jun 05, 2004 at 07:00 UTC
    I'm running Perl 5.6.0 on Linux and am getting warnings in my browser when I run my Perl programs:
    Um, then stop printing the warnings to your browser :)

    I placed the following code in my Perl program, but it does not seem to affect external modules such as sendmail...
    That's because warnings are a "lexical" pragma ({ no warnings 'all'; 'does not affect'; { use warnings; 'code here'}}).
    perldoc perlrun
    ...
     -W   Enables all warnings regardless of "no warnings" or "$^W". See the
          perllexwarn manpage.
    
     -X   Disables all warnings regardless of "use warnings" or "$^W". See
          the perllexwarn manpage.
    
    
    

    MJD says "you can't just make shit up and expect the computer to know what you mean, retardo!"
    I run a Win32 PPM repository for perl 5.6.x and 5.8.x -- I take requests (README).
    ** The third rule of perl club is a statement of fact: pod is sexy.

      Let me give some more information with regard to my problem. I moved from a web host (linux) to a dedicated linux server. On the web host, I was able to run my scripts without having warnings returned to the browser. I did have -w enabled and that was all.

      When I moved to the dedicated server, I noticed that warnings such as the "unititialized" warning started popping up on the browser with the same unchanged scripts. This makes me believe that there must be a setting somewhere that is more global to turn off warnings (such as a config file).

        ... This makes me believe that there must be a setting somewhere that is more global to turn off warnings (such as a config file).
        I see, so you have a broken server, can't help you there (STDERR is not STDOUT, but apparently your server thinks it is).

        MJD says "you can't just make shit up and expect the computer to know what you mean, retardo!"
        I run a Win32 PPM repository for perl 5.6.x and 5.8.x -- I take requests (README).
        ** The third rule of perl club is a statement of fact: pod is sexy.

Re: Receiving warnings in browser
by hsinclai (Deacon) on Jun 05, 2004 at 17:04 UTC
    Forgive me for probably misunderstanding your intent but - isn't the fact that Mail::Mailer is generating this error ultimately more important that the display of the error?

    I take it the mail is getting sent OK...

    Turning warnings off altogether might make it hard to find subsequent problems..