Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

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 ( [id://11137074]=note: print w/replies, xml ) Need Help??


in reply to Re^4: 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.

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

Replies are listed 'Best First'.
Re^6: Use of inherited AUTOLOAD for non-method is no longer allowed with Perl 5.34.
by Anonymous Monk on Sep 28, 2021 at 18:07 UTC

    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;

        Yes. This could explain the issue
        • first version had &UNIVERSAL::AUTOLOAD defined which started to cause warnings after deprication
        • someone started to add *AUTOLOAD=\&MASTER::AUTOLOAD and got rid of most but not all warnings, because he missed some packages.
        • the missed packages which still relied on UNIVERSAL fail now.
        consequence
        • The &UNIVERSAL::AUTOLOAD is cargo cult now and should be deleted°
        • The missed packages must be "repaired"
        (untested, till someone provides a real SSCCE)

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

        °) also because it's a horrible idea causing many problems

        Hi, Thank you for the suggestion , while it seems to work for the FP package, it is failing with below error for other packages in the code like MRhomepage.
        MRhomepage::MRhomepage__getHomepageType() is no longer allowed.
        Is there any way to make it more generic?
        Thank you

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11137074]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (5)
As of 2024-03-28 15:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found