Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

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

by LanX (Saint)
on Sep 27, 2021 at 17:20 UTC ( [id://11137056]=note: print w/replies, xml ) Need Help??


in reply to Re^2: 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, I have tried moving *AUTOLOAD = \&BASE_CLASS::AUTOLOAD; to BEGIN {} block, it's not working.

but that's the documented solution in perldelta.

Where is your SSCCE to reproduce your problem?

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

  • Comment on Re^3: Use of inherited AUTOLOAD for non-method is no longer allowed with Perl 5.34.

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

    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

      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

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (6)
As of 2024-04-16 06:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found