http://qs1969.pair.com?node_id=11137060


in reply to Re^3: Use of inherited AUTOLOAD for non-method is no longer allowed with Perl 5.34.
in thread Use of inherited AUTOLOAD for non-method is no longer allowed with Perl 5.34.

Hi, my code looks below, please ignore previous comment

##script homepage.pl #this script has been located in cgi folder where + it also has SUBS/APP folder package homepage; our ($AUTOLOAD_DEFINED); # This isn't necessary, but without it you ge +t a warning when perl uses UNIVERSAL::AUTOLOAD if (!$AUTOLOAD_DEFINED) # (from lib.pl): "Use of inherited AUTOLOAD f +or non-method...". (search for that warning { # text in 'perldoc perldiag' for more info. *AUTOLOAD = \&APP::AUTOLOAD; $AUTOLOAD_DEFINED = 1; } # # #below is the non-method called from the perl file (getStatuses.pl) lo +cated at cgi/SUBS/APP/Statues @Statuses = &APP::Statuses::getStatuses({IsResolvedFlag =>1}); #here + is is failing to autoload the script getStatuses.pl.

In other script (lib.pl) where AUTOLOAD function is defined which would control the autoloading part, it also has below line outside of AUTOLOAD function
# use APP package's AUTOLOAD for all packages that don't have their ow +n *UNIVERSAL::AUTOLOAD = \&APP::AUTOLOAD;

Note : I cant see anywhere autoLoader module has been used instead AUTOLOAD function has been written.
I hope this helps you to understand the scenario.
Thank you

Replies are listed 'Best First'.
Re^5: Use of inherited AUTOLOAD for non-method is no longer allowed with Perl 5.34.
by LanX (Saint) on Sep 28, 2021 at 00:35 UTC
    Sorry I don't know how to reproduce an example with this information ... maybe someone else.

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    Wikisyntax for the Monastery

      Below is the code to reproduce the error.

      package Homepage; use strict; use warnings; use diagnostics; require "MRlib.pl"; #this script has logic for AUTOLOAD written, wher +e it checks for main package and method name and call for require<br/ +> ## Upon using below require it works, otherwise, it throws Use of inhe +rited AUTOLOAD for non-method FP::Introduction::Introduce() is no lon +ger allowed at test_autoload.pl line 17. error ## require "C:\\Users\\xxx\\Documents\\Application\\Perl_upgrade\\test +_autoload\\SUBS\\App\\Introduction.pl"; BEGIN { *AUTOLOAD = \&FP::AUTOLOAD; } print "I started the program\n"; #Below Introduce sub is written in "C:\\Users\\xxx\\Documents\\Applica +tion\\Perl_upgrade\\test_autoload\\SUBS\\App\\Introduction.pl" script &FP::Introduction::Introduce; print "I got to the end of the program\n"; 1;


      I hope it makes sense now !
      Thank you

        Try changing

        *AUTOLOAD = \&FP::AUTOLOAD;
        to
        *FP::Introduction::AUTOLOAD = \&FP::AUTOLOAD;
        so that it matches the call you are making;