In perl.git, the branch abigail/deprecation has been updated <http://perl5.git.perl.org/perl.git/commitdiff/8a003ad2a09260e2fabe3bf2d9faa85a53c1979d?hp=d30393aaade31b605724846a30a10dd1e96cd181>
- Log ----------------------------------------------------------------- commit 8a003ad2a09260e2fabe3bf2d9faa85a53c1979d Author: Abigail <[email protected]> Date: Thu Nov 24 00:50:09 2016 +0100 Use of inherited AUTOLOAD for non-methods will be fatal in 5.28. Which will be 21 years after it was deprecated (5.004). ----------------------------------------------------------------------- Summary of changes: gv.c | 3 ++- pod/perldeprecation.pod | 26 ++++++++++++++++++++++++++ pod/perldiag.pod | 4 +++- t/lib/warnings/gv | 4 ++-- t/porting/diag.t | 2 +- 5 files changed, 34 insertions(+), 5 deletions(-) diff --git a/gv.c b/gv.c index 0bc5998..a948234 100644 --- a/gv.c +++ b/gv.c @@ -1217,7 +1217,8 @@ Perl_gv_autoload_pvn(pTHX_ HV *stash, const char *name, STRLEN len, U32 flags) ) Perl_ck_warner_d(aTHX_ packWARN(WARN_DEPRECATED), "Use of inherited AUTOLOAD for non-method %" SVf - "::%" UTF8f "() is deprecated", + "::%" UTF8f "() is deprecated. This will be " + "fatal in Perl 5.28", SVfARG(packname), UTF8fARG(is_utf8, len, name)); diff --git a/pod/perldeprecation.pod b/pod/perldeprecation.pod index 1387934..468cad2 100644 --- a/pod/perldeprecation.pod +++ b/pod/perldeprecation.pod @@ -186,6 +186,32 @@ of the variable happened in Perl 5.25.3. Setting this variable will become a fatal error in Perl 5.28. + + +=head3 Use of inherited AUTOLOAD for non-method %s() is deprecated + +As an (ahem) accidental feature, C<AUTOLOAD> subroutines are looked +up as methods (using the C<@ISA> hierarchy) even when the subroutines +to be autoloaded were called as plain functions (e.g. C<Foo::bar()>), +not as methods (e.g. C<< Foo->bar() >> or C<< $obj->bar() >>). + +This bug will be rectified in future by using method lookup only for +methods' C<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 C<AUTOLOAD> for non-methods from a base class +named C<BaseClass>, execute C<*AUTOLOAD = \&BaseClass::AUTOLOAD> during +startup. + +In code that currently says C<use AutoLoader; @ISA = qw(AutoLoader);> +you should remove AutoLoader from @ISA and change C<use AutoLoader;> to +C<use AutoLoader 'AUTOLOAD';>. + +This feature was deprecated in Perl 5.004, and will be fatal in Perl 5.28. + + + =head2 Perl 5.24 =head3 Use of C<< *glob{FILEHANDLE} >> diff --git a/pod/perldiag.pod b/pod/perldiag.pod index d581a63..1a22b80 100644 --- a/pod/perldiag.pod +++ b/pod/perldiag.pod @@ -6986,7 +6986,7 @@ scope is deprecated and should be avoided. This was deprecated in Perl 5.12, and will be a fatal error in Perl 5.28. -=item Use of inherited AUTOLOAD for non-method %s() is deprecated +=item Use of inherited AUTOLOAD for non-method %s() is deprecated. This will be fatal in Perl 5.28 (D deprecated) As an (ahem) accidental feature, C<AUTOLOAD> subroutines are looked up as methods (using the C<@ISA> hierarchy) @@ -7010,6 +7010,8 @@ In code that currently says C<use AutoLoader; @ISA = qw(AutoLoader);> you should remove AutoLoader from @ISA and change C<use AutoLoader;> to C<use AutoLoader 'AUTOLOAD';>. +This feature was deprecated in Perl 5.004, and will be fatal in Perl 5.28. + =item Use of %s in printf format not supported (F) You attempted to use a feature of printf that is accessible from diff --git a/t/lib/warnings/gv b/t/lib/warnings/gv index 1c407df..08a8474 100644 --- a/t/lib/warnings/gv +++ b/t/lib/warnings/gv @@ -46,7 +46,7 @@ fred() ; my $x = \&barney; (bless[])->barney; EXPECT -Use of inherited AUTOLOAD for non-method main::fred() is deprecated at - line 5. +Use of inherited AUTOLOAD for non-method main::fred() is deprecated. This will be fatal in Perl 5.28 at - line 5. ######## # gv.c use utf8; @@ -56,7 +56,7 @@ sub OáÊ::AUTOLOAD { 1 } sub OáÊ::fáÆ {} use warnings 'deprecated' ; fáÆ() ; EXPECT -Use of inherited AUTOLOAD for non-method main::fáÆ() is deprecated at - line 7. +Use of inherited AUTOLOAD for non-method main::fáÆ() is deprecated. This will be fatal in Perl 5.28 at - line 7. ######## # gv.c $a = ${^ENCODING}; diff --git a/t/porting/diag.t b/t/porting/diag.t index cdd9d64..f3805d5 100644 --- a/t/porting/diag.t +++ b/t/porting/diag.t @@ -685,7 +685,7 @@ Usage: VMS::Filespec::unixrealpath(spec) Usage: VMS::Filespec::vmsify(spec) Usage: VMS::Filespec::vmspath(spec) Usage: VMS::Filespec::vmsrealpath(spec) -Use of inherited AUTOLOAD for non-method %s::%s() is deprecated +Use of inherited AUTOLOAD for non-method %s::%s() is deprecated. This will be fatal in Perl 5.28 utf8 "\x%X" does not map to Unicode Value of logical "%s" too long. Truncating to %i bytes waitpid: process %x is not a child of process %x -- Perl5 Master Repository
