in reply to Re^2: How can I avoid creating two instances of the same object
in thread How can I avoid creating two instances of the same object

@ISA will not load the modules, you have to do that yourself. @ISA merely tells Perl what namespaces to look through to find methods. If the namespace is empty (because you haven't loaded a module), Perl doesn't particularly mind.

The example I gave you showed you how you would call a method as a class method. The equivalent object-style call was in the comments. Speedwise, I think it's a slight benefit to call things as class methods, because Perl doesn't have to search the inheritance tree.

Using your original example, your code might looks like this:

use Data::Dumper; use User; my $dbh = User->new(); use Company; # Pretend that $dbh is a Company and call its do_something method, # equivalent to $dbh->do_something, if $dbh were a Company $dbh->Company::do_something;

Caution: Contents may have been coded under pressure.