I've written modules for my own use, but I'm making the leap to something publicly available on CPAN. This brings a lot more complexity and responsibility, so I'd appreciate some advice.
Ultimately, this code will a)take a specially formatted input file and break pieces of it out to separate files and b) offer a reverse function to bundle many text files into one.1 For this discussion, just think of tar/untar and you'll basically be right on track.
Now, the question:
I'm planning on offering a pair of command-line scripts with my module in addition to the callable module. (Much like /usr/bin/module-starter that comes with Module::Starter .) However, when people call my routines from perl, I don't really want to do any real I/O. It seems like that's over zealous, and frankly, I don't want the responsibility of opening and writing to someone else's filesystem.
So, given that I'm passed an input filename and an output directory name, should I:
- open the neccessary files and write to them, assuming the caller knows what he's doing
- return a hashref with output names as keys, and file contents as data values (caller can write them out himself)
- something else?
1Technically, I'm working on replicas of IEBUPDTE and IEBPTPCH. They are utilities to let me work with mainframe PDS members locally. This is OS/390, z/OS stuff.
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.