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.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.