in reply to Strict error on var when using Mail::SendMail

It's not actually an error, and it's not strict that's complaining. It is in fact a warning, and diagnostics warns you.

I don't think the diagnostics pragma allows you to selectively disable its messages, like you can with e.g.  no warnings 'once', but you can turn all diagnostics off and on:

use diagnostics; disable diagnostics; do_naughty_stuff(); enable diagnostics; do_nice_things();
For more details, see the manuals for diagnostics and warnings.

Replies are listed 'Best First'.
Re^2: Strict error on var when using Mail::SendMail
by ikegami (Patriarch) on Mar 22, 2007 at 06:13 UTC

    That doesn't work for two reasons.

    • disable diagnostics; only affects run-time warnings. "used only once" is a compile-time warning.
    • disable diagnostics; doesn't disable the warning, just the diagnostic. So while disable diagnostics; would remove the diagnostic message, the basic warning message would still be displayed.

    The solution is to eliminate the warning (using no warnings 'once'; for example), since there's no diagnostic message if there's no warning.