so what is the correct way to tell my data object how it should present itself?
Of course there is never the correct way :-)
However, it might help to split the functionality into three layers:
- Reports - to handle the details of the different report types (RevenueReport, SalesReport, etc.)
- ReportFormatters - take report objects and provide a format-independent API to their structure (e.g. $rf->header, $rf->content, etc.)
- ReportRenderers - that take a ReportFormat object and output it in a particular format (ReportRenderPDF, ReportRenderHTML, etc.)
So all the report specific information stays in the Report class. All the output-format specific information stays in the ReportRender classes.
Hopefully this makes some sort of vague sense :-)
Update: Just noticed - this was my 1000th post. Gosh.
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|