Due to recent job search needs in my family, I've been working on a Perl
module that will take a resume in XML format and translate it to a variety of
formats. I did some looking around the Internet, but none of the wheels I found were quite the right shape or size for my needs, and I thought it'd be a fun learning project. Right now I have a single object with the following output
functions:
- output_raw - simply uses the toString method to return the raw XML
- output_html - uses XSLT to transform the XML resume to (X)HTML
- output_text - uses XSLT to transfor the XML resume to reasonably laid out
text, then uses Text::Wrap to wrap long lines to 80 columns
- output_pdf - the most ambitious, uses XSLT to transform the XML resume into
a series of sections and lines that are then fed to PDFLib to generate
a PDF file.
My question is this: should I keep this as a single object, or sub-class
each output style into a child object. Ie, something like this:
- Resume - contains the basic functions for importing the XML resume and has an output function that returns the raw XML
- Resume::HTML - child of Resume that overloads the output function with one that transforms the XML to HTML and returns that
- Resume::Text - child of Resume that overloads the output function with one that transforms the XML to ASCII text
- Resume::PDF - contains all of the PDF functions and overloads the output function with one that generates the PDF file
I'm kind of leaning toward this new setup, which I believe leaves me open for
future enhancements, but I thought I'd see what the experts have to say. I'd
also love to hear any additional features or output formats you think I should
add. Once I get more of the code put together, I'll be happy to post it for
review.
-rattus __________
He seemed like such a nice guy to his neighbors /
Kept to himself and never bothered them with favors
- Jefferson Airplane, "Assassin"
-
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.
|