in reply to Switch off warning for UNIVERSAL::AUTOLOAD

The quickest way is to do this: my $tmp = $^W; local($^W) = 0; #offending code here $^W = $tmp; # reset to original state Although, if you're writing it correctly you shouldn't be getting this warning. Are you writing with 'use strict;'? Erik Hollensbe
  • Comment on RE: Switch off warning for UNIVERSAL::AUTOLOAD

Replies are listed 'Best First'.
RE: RE: Switch off warning for UNIVERSAL::AUTOLOAD
by Yaakov (Novice) on Aug 08, 2000 at 22:16 UTC
    You are completely right. I should not get a warning for correct code. Because of this, I switch the warning on and use strict.

    However, the UNIVERSAL::AUTOLOAD method provides a functionality (to catch all missing routintes in one place) that I need and that Perl has decided to drop in the future. So, while it is still there, I want to use it and Perl wants to warn me that in future the code might break. I read the warning and want to suppress it now. Still other warnings should be displayed and fixed in the code.

    As it stands, every piece of code that calls a function could trigger UNIVERSAL::AUTOLOAD and thus be "offending".

    Maybe there is a way to keep the UNIVERSAL::AUTOLOAD feature in Perl ...