in reply to Re: Package Variables in Inheritance
in thread Package Variables in Inheritance

Cool. That makes me feel better. Basically, I know there are several ways to do this. The real code is a report writer. There are 3 variables I want to be able to change in a child class. Then I want to over load two function header() and footer() if necessary. Brain is fried, but basically, here's what I'm trying to accomplish.

Base Class is the Report Writer. It doesn't care what its writing, it writes things. I want to inherit from it and change 3 variables, the sheetname, the header array (column names), and the fields hash (which is kinda cool, it knows how to extract each field from a generic hash which is used to generate 7 different reports). I'm lazy (this is why I love perl) and I wanted to basically do this:
package Report::Writer::Test; use vars qw/@ISA/; @ISA=qw/Report::Writer/; $SheetName = "Test"; @HEADER = qw/I AM TESTING/; %Fields = ( I => sub { return uc $_[0]->{firscol} }, AM => 'secondcol', TESTING => 'PLACE HOLDER' );
The end result, is based on my Report::Writer module, I wouldn't have to write anything else to make Report::Writer::Test work.

broquaint's solution was what I was looking for. I'll investigate Class::Data::Inheritable to see if it does what I want it to do. Thank you for the suggestion.
-brad..