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"
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.