Re: Suppress warning



On Apr 20, 10:53 am, Ian Wilson <scoblo...@xxxxxxxxxxxxx> wrote:
When I run the code below I get an unwanted warning and the expected result.

> soapclientauto.pl
Use of inherited AUTOLOAD for non-method main::c2f() is deprecated at
soapclientauto.pl line 11.
41.1C = 105.98F.

------------------------------------------------------
#!perl
use strict;
use warnings;

use SOAP::Lite +autodispatch =>
uri => 'http://www.example.com/Temperature',
proxy => 'http://localhost/cgi-bin/soapservice.pl';

{
no warnings 'deprecated';
print "41.1C = ", c2f(41.1), "F.\n";}

------------------------------------------------------
ActiveState Perl 5.8.8 on XP

The warning arises when I use SOAP::Lite's "autodispatch" feature.

`no warnings;` suppresses the warning but seems overkill.

Is there a way to identify the category of warning so I can suppress it
more selectively?

Is there another way to avoid whatever the warning is warning me of
(which I don't understand) - assuming I don't want to tinker with
SOAP::Lite?

All of Perl's warnings and errors are well documented in `perldoc
perldiag`:

Use of inherited AUTOLOAD for non-method %s() is deprecated
(D deprecated) As an (ahem) accidental feature,
"AUTOLOAD" subroutines are looked up as methods (using
the @ISA hierarchy) even when the subroutines to be
autoloaded were called as plain functions (e.g.
"Foo::bar()"), not as methods (e.g. "Foo->bar()" or
"$obj->bar()").

This bug will be rectified in future by using method
lookup only for methods' "AUTOLOAD"s. However, there is
a significant base of existing code that may be using
the old behavior. So, as an interim step, Perl
currently issues an optional warning when non-methods
use inherited "AUTOLOAD"s.

The simple rule is: Inheritance will not work when
autoloading non-methods. The simple fix for old code
is: In any module that used to depend on inheriting
"AUTOLOAD" for non-methods from a base class named
"BaseClass", execute "*AUTOLOAD = \&BaseClass::AUTOLOAD"
during startup.

In code that currently says "use AutoLoader; @ISA =
qw(AutoLoader);" you should remove AutoLoader from @ISA
and change "use AutoLoader;" to "use AutoLoader
'AUTOLOAD';".




.



Relevant Pages

  • Re: Odd behavior in 2005 with base page classes
    ... way page inheritance works in 2.0. ... Conversion Wizard adds and you end up with some cases where you get errors ... >I have converted two ASP.NET 1.1 applications to ASP.NET 2.0. ... > Warning 3 'Nwea.BlueWater.GenericError.ApplicationInstance' hides ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: public inheritance of interfaces and virtual (multiple) inheri
    ... I will not cling to the death to use virtual inheritance. ... However, in MFC, you need to declare a pointer to a member of a class ... we can end up corrupting pointers. ... There is a warning, ...
    (microsoft.public.vc.language)
  • Re: public inheritance of interfaces and virtual (multiple) inheritanc
    ... I would like to use public inheritance ... Particularly, I have 2 abstract base interface classes, ... There is a warning, ... Pointers to member functions became 16 byte. ...
    (microsoft.public.vc.language)
  • Re: Message Map with multiple inheritance
    ... What should the implementation of the timer function look like? ... The warning indicates the two do not agree. ... or CObject then there should be no inheritance issues - this is likely a red ... > And the WM_TIMER gives me a compiler error of: ...
    (microsoft.public.vc.mfc)