Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use of inherited AUTOLOAD for non-method is deprecated #15547

Closed
p5pRT opened this issue Aug 24, 2016 · 7 comments
Closed

Use of inherited AUTOLOAD for non-method is deprecated #15547

p5pRT opened this issue Aug 24, 2016 · 7 comments

Comments

@p5pRT
Copy link

p5pRT commented Aug 24, 2016

Migrated from rt.perl.org#129067 (status was 'resolved')

Searchable as RT129067$

@p5pRT
Copy link
Author

p5pRT commented Aug 24, 2016

From @KES777

Created by @KES777

It seems my problem is related to https://rt.perl.org/Public/Bug/Display.html?id=47047

Now I am extending existing mojolicious application. I just add method to
one of our modules and get error when process request to application​:

Use of inherited AUTOLOAD for non-method FH​::Controller​::Cart​::promo() is deprecated at ...

/usr/local/share/perl/5.14.2/Mojolicious/Routes.pm
  x161​: if (my $sub = $app->can('routes')) {
  x162​: my $r = $app->$sub;
  x163​: weaken $r->parent($c->match->endpoint)->{parent} unless $r->parent;
  164​: }
  x165​: $app->$sub($c);
  x166​: $c->stash->{'mojo.routed'}++;
  167​: }
  168​:
  169​: # Action
  x170​: elsif (my $method = $self->_method($c, $field)) {
  x171​: $log->debug(qq{Routing to controller "$class" and action "$method".});
  172​:
  173​: # Try to call action
  x174​: if (my $sub = $app->can($method)) {
  x175​: $c->stash->{'mojo.routed'}++ unless $staging;
  >>176​: $continue = $app->$sub;
  177​: }
  178​:
  179​: # Action not found
  x180​: else { $log->debug('Action not found in controller.') }
  181​: }
  182​:
  x183​: return !$staging || $continue ? 1 : undef;
  184​: }
  185​:
  186​: sub _load {
  x187​: my ($self, $app) = @​_;
  188​:
  189​: # Load unless already loaded
  x190​: return 1 if $self->{loaded}{$app};
  x191​: if (my $e = Mojo​::Loader->new->load($app)) { ref $e ? die $e : return undef }

DBG>$method
promo

DBG>$app
FH​::Controller​::Cart=HASH(0x9ef96f8)

DBG>$app->can($method)
CODE(0x9df12e0)

DBG>\&{ FH​::Controller​::Cart​::promo }
CODE(0x9df12e0)

But deparsing subroutine by this reference with B​::Deparse just shows ';'
DBG>l $sub
;

Step into the sub brings me into AUTOLOAD instead of target method​:
DBG>s
/usr/local/share/perl/5.14.2/Mojolicious/Controller.pm
  x14​: use Scalar​::Util ();
  15​:
  x16​: has app => sub { Mojolicious->new };
  17​: has match => sub {
  x18​: Mojolicious​::Routes​::Match->new(GET => '/')->root(shift->app->routes);
  x19​: };
  x20​: has tx => sub { Mojo​::Transaction​::HTTP->new };
  21​:
  22​: # Reserved stash values
  x23​: my %RESERVED = map { $_ => 1 } (
  24​: qw(action app cb controller data extends format handler json layout),
  25​: qw(namespace partial path status template text)
  26​: );
  27​:
  28​: sub AUTOLOAD {
  >>29​: my $self = shift;
  30​:
  x31​: my ($package, $method) = our $AUTOLOAD =~ /^([\w​:]+)​::(\w+)$/;
  x32​: Carp​::croak "Undefined subroutine &${package}​::$method called"
  33​: unless Scalar​::Util​::blessed $self && $self->isa(__PACKAGE__);
  34​:
  35​: # Call helper with current controller
  x36​: Carp​::croak qq{Can't locate object method "$method" via package "$package"}
  37​: unless my $helper = $self->app->renderer->helpers->{$method};
  x38​: return $self->$helper(@​_);
  39​: }
  40​:
  x41​: sub DESTROY { }
  42​:
  43​: sub cookie {
  x44​: my ($self, $name, $value, $options) = @​_;

The target method is here​:
package FH​::Controller​::Cart;

use Mojo​::Base 'FH​::Controller';

use Encode qw(encode);
use List​::Util qw(first sum pairmap );
use Mojo​::Util qw(quote);
use Data​::Dumper;

use FH​::Form​::Handler ();
use FH​::Error qw/ERROR_MINIMAL_ORDER/;

....

sub promo {
  my( $self ) = @​_;
}

Perl Info

Flags:
    category=core
    severity=low

Site configuration information for perl 5.14.2:

Configured by Debian Project at Tue Mar  1 18:43:59 UTC 2016.

Summary of my perl5 (revision 5 version 14 subversion 2) configuration:
   
  Platform:
    osname=linux, osvers=2.6.53-79-generic, archname=x86_64-linux-gnu-thread-multi
    uname='linux lcy01-28 2.6.53-79-generic #123-ubuntu smp fri feb 19 14:27:58 utc 2016 x86_64 x86_64 x86_64 gnulinux '
    config_args='-Dusethreads -Duselargefiles -Dccflags=-DDEBIAN -Dcccdlflags=-fPIC -Darchname=x86_64-linux-gnu -Dprefix=/usr -Dprivlib=/usr/share/perl/5.14 -Darchlib=/usr/lib/perl/5.14 -Dvendorprefix=/usr -Dvendorlib=/usr/share/perl5 -Dvendorarch=/usr/lib/perl5 -Dsiteprefix=/usr/local -Dsitelib=/usr/local/share/perl/5.14.2 -Dsitearch=/usr/local/lib/perl/5.14.2 -Dman1dir=/usr/share/man/man1 -Dman3dir=/usr/share/man/man3 -Dsiteman1dir=/usr/local/man/man1 -Dsiteman3dir=/usr/local/man/man3 -Duse64bitint -Dman1ext=1 -Dman3ext=3perl -Dpager=/usr/bin/sensible-pager -Uafs -Ud_csh -Ud_ualarm -Uusesfio -Uusenm -Ui_libutil -DDEBUGGING=-g -Doptimize=-O2 -Duseshrplib -Dlibperl=libperl.so.5.14.2 -des'
    hint=recommended, useposix=true, d_sigaction=define
    useithreads=define, usemultiplicity=define
    useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
    use64bitint=define, use64bitall=define, uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='cc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -DDEBIAN -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
    optimize='-O2 -g',
    cppflags='-D_REENTRANT -D_GNU_SOURCE -DDEBIAN -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include'
    ccversion='', gccversion='4.6.3', gccosandvers=''
    intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
    ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
    alignbytes=8, prototype=define
  Linker and Libraries:
    ld='cc', ldflags =' -fstack-protector -L/usr/local/lib'
    libpth=/usr/local/lib /lib/x86_64-linux-gnu /lib/../lib /usr/lib/x86_64-linux-gnu /usr/lib/../lib /lib /usr/lib
    libs=-lgdbm -lgdbm_compat -ldb -ldl -lm -lpthread -lc -lcrypt
    perllibs=-ldl -lm -lpthread -lc -lcrypt
    libc=, so=so, useshrplib=true, libperl=libperl.so.5.14.2
    gnulibc_version='2.15'
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E'
    cccdlflags='-fPIC', lddlflags='-shared -O2 -g -L/usr/local/lib -fstack-protector'

Locally applied patches:
    


@INC for perl 5.14.2:
    /home/kes/perl_lib/lib/perl5/x86_64-linux-gnu-thread-multi
    /home/kes/perl_lib/lib/perl5
    /etc/perl
    /usr/local/lib/perl/5.14.2
    /usr/local/share/perl/5.14.2
    /usr/lib/perl5
    /usr/share/perl5
    /usr/lib/perl/5.14
    /usr/share/perl/5.14
    /usr/local/lib/site_perl
    .


Environment for perl 5.14.2:
    HOME=/home/kes
    LANG=en_US.UTF-8
    LANGUAGE=en
    LC_MESSAGES=en_US.UTF-8
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=/home/kes/perl_lib/bin:/home/kes/bin:/home/kes/perl_lib/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
    PERL5LIB=/home/kes/perl_lib/lib/perl5
    PERL_BADLANG (unset)
    PERL_MB_OPT=--install_base "/home/kes/perl_lib"
    PERL_MM_OPT=INSTALL_BASE=/home/kes/perl_lib
    SHELL=/bin/bash

@p5pRT
Copy link
Author

p5pRT commented Aug 24, 2016

From @cpansprout

On Wed Aug 24 07​:20​:32 2016, kes-kes@​yandex.ru wrote​:

This is a bug report for perl from kes-kes@​yandex.ru,
generated with the help of perlbug 1.39 running under perl 5.14.2.

-----------------------------------------------------------------
[Please describe your issue here]

It seems my problem is related to
https://rt.perl.org/Public/Bug/Display.html?id=47047

Which was not re-opened when the patch was reverted. I have just re-opened it, as it is still a problem in current blead (v5.25.4).

--

Father Chrysostomos

@p5pRT
Copy link
Author

p5pRT commented Aug 24, 2016

The RT System itself - Status changed from 'new' to 'open'

@p5pRT
Copy link
Author

p5pRT commented Sep 5, 2016

From @cpansprout

On Wed Aug 24 16​:56​:02 2016, sprout wrote​:

On Wed Aug 24 07​:20​:32 2016, kes-kes@​yandex.ru wrote​:

This is a bug report for perl from kes-kes@​yandex.ru,
generated with the help of perlbug 1.39 running under perl 5.14.2.

-----------------------------------------------------------------
[Please describe your issue here]

It seems my problem is related to
https://rt.perl.org/Public/Bug/Display.html?id=47047

Which was not re-opened when the patch was reverted. I have just re-
opened it, as it is still a problem in current blead (v5.25.4).

The problem is now fixed as of commit 1de22db..

--

Father Chrysostomos

@p5pRT
Copy link
Author

p5pRT commented Sep 5, 2016

@cpansprout - Status changed from 'open' to 'pending release'

@p5pRT
Copy link
Author

p5pRT commented May 30, 2017

From @khwilliamson

Thank you for filing this report. You have helped make Perl better.

With the release today of Perl 5.26.0, this and 210 other issues have been
resolved.

Perl 5.26.0 may be downloaded via​:
https://metacpan.org/release/XSAWYERX/perl-5.26.0

If you find that the problem persists, feel free to reopen this ticket.

@p5pRT
Copy link
Author

p5pRT commented May 30, 2017

@khwilliamson - Status changed from 'pending release' to 'resolved'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant