in reply to Method calling question...

I don't see what the problem is:
package Base; sub method1 { # Insert code here print "Called from class: ", shift, "\n"; }; package Foo; @ISA = qw(Base); package Bar; @ISA = qw(Base); package main; foreach my $classname qw(Foo Bar) { $classname->method1; } ## Output ## Called from class: Foo Called from class: Bar
   MeowChow                                   
               s aamecha.s a..a\u$&owag.print

Replies are listed 'Best First'.
Re: Re: Method calling question...
by satchboost (Scribe) on May 01, 2001 at 02:26 UTC
    There's a reason I was using four files. If you have everything in one file, of course it works cause method1 is scoped within the file. When you have it across several files, it breaks down. :(
      It's not a scoping issue:
      foreach my $classname qw(Foo Bar Oops) { $classname->method1; } ## output ## Can't locate object method "method1" via package "Oops" at C:\Projects +\GPerl\Test\2.pl line 16. Called from class: Foo Called from class: Bar
         MeowChow                                   
                     s aamecha.s a..a\u$&owag.print
        Ok. I must've been doing something else wrong. *sighs* I'll putz with it further.