Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

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

by Anonymous Monk
on Sep 29, 2021 at 10:24 UTC ( #11137106=note: print w/replies, xml ) Need Help??


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

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

Replies are listed 'Best First'.
Re^9: Use of inherited AUTOLOAD for non-method is no longer allowed with Perl 5.34.
by tybalt89 (Prior) on Sep 29, 2021 at 16:07 UTC

    I'm guessing your file "MRlib.pl" has a mapping from package name to file to require.
    Use that package name list to generate and eval a set of *${packagename}::AUTOLOAD = \&FP::AUTOLOAD; statements.
    That may have to be in a BEGIN block.

    UPDATE: fixed ')' to '}'

      > and eval a set of

      no eval needed with no strict 'refs';

      use strict; use warnings; package FP; sub AUTOLOAD { our $AUTOLOAD; print "hello $AUTOLOAD\n" } my @pkgs =qw/BLA BLUB MyHomepage::Introduction/; for my $PKG (@pkgs) { no strict 'refs'; *{ "${PKG}::AUTOLOAD" } = \&FP::AUTOLOAD } BLA::bla(); MyHomepage::Introduction::intro();

      hello BLA::bla hello MyHomepage::Introduction::intro

      But I already suggested Importing in my first reply ...

      update
      BTW: typo
      *${packagename)::AUTOLOAD = \&FP::AUTOLOAD; ^

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

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (3)
As of 2021-12-04 19:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    R or B?



    Results (30 votes). Check out past polls.

    Notices?