On Wednesday, August 21, 2002, at 10:06 , Paul Tremblay wrote:
> I am writing a script that converts RTF to XML, and this script needs > to read an external data file to form a hash. I plan to make this > script available to anyone who needs it, and am wondering what to do > with this external data file. when you say 'external data file' - do you mean things that are required for the script itself to work? if so, you may want to look at the traditional solution of getting those to install into the site_perl as a perl module, hence you will most likely want to look at h2xs as a first round for how to do that.... or do you mean, as seems to be suggested below, any 'temporary files' that are created in transit? > Should I simply make the data file available with the script and tell > the user where to put it? Right now, I have it in > /usr/share/rtf2xml/char_data.data. a reasonable alternative plan - but going with the traditional perl module approach will mean that they can then just do the usual perl Makefile.PL make make test make install and let it go at that... This way if you need to upgrade along the way - and it's all nice and neatly in a perl module - you can then distribute a new release of it - and not need to upgrade the core code itself. [..] > Also, the script outputs to standard output. Future versions might > require that the script make one run through the file, write to a temp > file, then make a run through the temp file. Where should I put this > temp file (if I need to make one, that is)? [..] you might want to look at IO::File and use the new_tmpfile method to create a temp file 'for the duration' - before sending it to stdout.... also IF in this future upgrade you start doing the myCode Infile Outfile then you could use the file named as Outfile as the temp file, unless you allow things like myCode Infile - | doFoo where you expressly allow '-' as the 'cheat' that you want the output to finally go to stdout.... ciao drieux --- -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]