Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical

AUTOLOAD -- deprecated, in relation to inherited method/function

by Sifmole (Chaplain)
on Jun 29, 2004 at 18:51 UTC ( #370575=perlquestion: print w/replies, xml ) Need Help??
Sifmole has asked for the wisdom of the Perl Monks concerning the following question:

All, I have been stumped by this one for a while, and was hoping you all could help. I have a pair of classes, the second inherits from the first -- like this:
package Foo::Bar; use strict; use Exporter; use vars qw( @ISA @EXPORT_OK ); @ISA = qw(Exporter); @EXPORT_OK = qw(&doSomething); sub new { blah blah blah... } sub dosomething { blah blah blah }
package Foo::Bar::Blah; use strict; use Foo::Bar qw(doSomething); use vars qw( @ISA ); @ISA = qw(Foo::Bar);
Now in (sample) code I have the following:
use strict; use Foo::Bar::Blah; Foo::Bar::Blah::doSomething('xyz');
I get the following error:
Use of inherited AUTOLOAD for non-method Foo::Bar::Blah::doSomething() + is deprecated at ./tests/ ... Can't locate auto/Foo/Bar/Blah/ in @INC ...
This doSomething() function is intended to be able to be called as either a method of an instance or a straight function call. If I call it like:
There is no issue reported, and it appears to function properly.

Can anybody shed some light on this?

Note: this is using perl 5.8.2

Replies are listed 'Best First'.
Re: AUTOLOAD -- deprecated, in relation to inherited method/function
by Fletch (Chancellor) on Jun 29, 2004 at 19:04 UTC

    As with any perl error message you can look it up in perldoc perldiag (or add use diagnostics; to your code, or pipe stderr through the splain utility). There's an explanation and a workaround for this therein.

Re: AUTOLOAD -- deprecated, in relation to inherited method/function
by dragonchild (Archbishop) on Jun 29, 2004 at 18:59 UTC
    The following works for 5.8.0 on RH9 threaded.
    In package Foo; use strict; use warnings; use Exporter; our @ISA = qw( Exporter ); our @EXPORT_OK = qw( foo ); sub foo { print "Foo\n"; } 1; ---------- In package Bar; use strict; use warnings; use Foo qw( foo ); our @ISA = qw( Foo ); sub bar { foo() } 1; ---------- In #!/usr/bin/perl use strict; use warnings; use Bar; Bar::foo(); Bar::bar();


    We are the carpenters and bricklayers of the Information Age.

    Then there are Damian modules.... *sigh* ... that's not about being less-lazy -- that's about being on some really good drugs -- you know, there is no spoon. - flyingmoose

    I shouldn't have to say this, but any code, unless otherwise stated, is untested

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://370575]
Approved by Arunbear
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (4)
As of 2017-07-23 15:32 GMT
Find Nodes?
    Voting Booth?
    I came, I saw, I ...

    Results (347 votes). Check out past polls.