Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

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

by Anonymous Monk
on Sep 27, 2021 at 08:35 UTC ( #11137026=perlquestion: print w/replies, xml ) Need Help??

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks,

How to resolve below issue effectively which happens due to use of non-methods, please note that methods have been used at many places in the application

"inherited AUTOLOAD for non-method is no longer allowed."

Note that in package i already have it defined, below

*AUTOLOAD = \&BASE_CLASS::AUTOLOAD; #this doesn't seem to work
Any help would be greatly appreciated.
  • Comment on Use of inherited AUTOLOAD for non-method is no longer allowed with Perl 5.34.
  • Download Code

Replies are listed 'Best First'.
Re: Use of inherited AUTOLOAD for non-method is no longer allowed with Perl 5.34.
by choroba (Archbishop) on Sep 27, 2021 at 08:45 UTC
    Reminds me of Perl 28 broke L: How to fix?. You didn't provide much details, but maybe you can find some consolation there.

    map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]
Re: Use of inherited AUTOLOAD for non-method is no longer allowed with Perl 5.34.
by soonix (Canon) on Sep 27, 2021 at 08:45 UTC
Re: Use of inherited AUTOLOAD for non-method is no longer allowed with Perl 5.34.
by LanX (Sage) on Sep 27, 2021 at 14:49 UTC
    Updated Preface:

    I understand your question as the desire to use the same AUTOLOAD in different files/packages.

    And I presume you already tried the obvious - importing - and it failed.

    main

    > *AUTOLOAD = \&BASE_CLASS::AUTOLOAD;  #this doesn't seem to work

    one guess: did you put this in a BEGIN {} block?

    untested since you didn't provide an SSCCE to reproduce it and the concept really looks like *a terrible hack*...

    edit

    A more terrible hack would be to do

    BEGIN { eval <<"__CODE__"; sub AUTOLOAD { $BODY_OF_ORIG_AUTOLOAD } __CODE__ }

    like this the AUTOLAD could be indistiguishible from a real autoload

    edit

    or

    BEGIN { require "The_Autoload.pl"; }

    with

    sub AUTOLOAD { ... # Body of Autoload }

    inside.

    again untested for mentioned reasons

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

      Hi, I have tried moving *AUTOLOAD = \&BASE_CLASS::AUTOLOAD; to BEGIN {} block, it's not working.
      Note that i am having perl 5.34.
      using require for that particular .pl file seems working for me, but i have to modify all such instances for the same.
      i am looking for better solution.
      Thank you

        > but i have to modify all such instances for the same

        same with  *AUTOLOAD = \&BASE_CLASS::AUTOLOAD;

        (shrug) !

        I know many dirty workarounds° in Perl but I doubt what you want is possible or even desirable.

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

        °) well as always with Perl ... provided the base class is directly used one could try a source filter to inject sub AUTOLOAD in the importing file. But I wanna be damned before showing how...

Re: Use of inherited AUTOLOAD for non-method is no longer allowed with Perl 5.34.
by Anonymous Monk on Sep 27, 2021 at 09:29 UTC
    Monks, thank you for the revert. I already checked that question and answers for it.

    But still, i couldn't figure it out how I can resolve this issue of non-methods being called from the package which used to work with Perl version 5.24.

    Regards.

      I'd say, first step would be to identify which non-methods you are calling and are affected, because the resolution of your problem depends on that.

      Can you please stop putting </br> in your writeups? The correct markup is <br/>. The slash goes after the br. Though really you can just leave out the slash. Thank you.

        Sure, Thank you.
        Regards

Re: Use of inherited AUTOLOAD for non-method is no longer allowed with Perl 5.34.
by Anonymous Monk on Oct 05, 2021 at 14:39 UTC

    Thank you LanX and tybalt89 this seems to be working, looks like I need to change my MRlib.pl file accordingly.
    sorry for reverting a bit late.
    Regards.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (3)
As of 2021-10-17 07:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My first memorable Perl project was:







    Results (71 votes). Check out past polls.

    Notices?