I have a base class like this:
package MyClass;
use vars qw/$ME list of vars/;
use Exporter;
@ISA = qw/Exporter/;
@EXPORT_OK = qw/ many variables & functions/;
%EXPORT_TAGS = (all => \@EXPORT_OK );
sub my_method {
}
sub other_methods etc {
}
--- more code---
I want to subclass MyClass
, but only for one method.
package MySubclass;
use MyClass;
use vars qw/@ISA/;
@ISA = 'MyClass';
sub my_method {
--- new method
}
And I want to call this MySubclass
like I would the original MyClass
, and still have access to all of the variables and functions from Exporter
. However I am having problems getting the Exporter
variables from the original class, MyClass
, to export correctly. Do I need to run Exporter
again inside the subclass? That seems redundant and unclear.
Example file:
#!/usr/bin/perl
use MySubclass qw/$ME/;
-- rest of code
But I get compile errors when I try to import the $ME
variable. Any suggestions?