Release ======= Getopt::ArgvFile 1.0. Overview ======== This module is a simple supplement to other option handling modules. It allows script options and parameters to be read from files instead of from the command line by interpolating file contents into @ARGV. This way it PREPARES the final option handling. Getopt::ArgvFile does NOT perform any option processing itself, and should work fine together with any other option handling module (e.g. Getopt::Long) or even self coded option handling. Well, the usual process can be illustrated by the following: --------------- command -> @ARGV -> | Getopt::xxx | line --------------- Getopt::ArgvFile adds an additional interpolation of @ARGV, replacing strings pointing to files with options by the contents of these files: ------------- --------------- command -> @ARGV with -> | Getopt:: | -> @ARGV with -> | Getopt::xxx | line file hints | ArgvFile | options only --------------- ------------- | ^ v | | option files -------- For example, let's say your script accepts two mandatory options ("-first" and "-second") each taking parameters, which have to be followed by three script parameters, the usual call would be anything like yourScript -first 1stPar -second 2ndPar par1 par2 par3 If a user finds out that the options and their parameters are almost always the same for him, and if you use Getopt::ArgvFile in your script, he could store the stable part of this call in a file like # always pass 1stPar to -first -first 1stPar # as well as 2ndPar to -second -second 2ndPar If this file is named "opts", subsequent calls may be shortened to yourScript @opts par1 par2 par3 What your script will see in @ARGV after a call of Getopt::ArgvFile::argvFile() will be exactly the same as in the initial call showed above, so that the script can process the command line as usual then. But from the USERS point of view, the call was simpler indeed. More, if even the script parameters do not change from call to call, they may be stored in a second file "pars", and the call would become yourScript @opts @pars The use of Getopt::ArgvFile can simplify periodical script calls as well as increase the handability of multi option scripts. (As an example, imagine a cronjob set up with option files which could be completely maintained outside the crontab.) Further more, Getopt::ArgvFile supports both option file nesting and cascading as well as automatically read "default option files". Please see the documentation for details. It also contains several usage examples. Synopsis ======== To offer support of option files, simply add something like the following to your script: # load module use Getopt::ArgvFile qw(argvFile); # solve option files, if any argvFile(); Now the command line can be processed as usual, e.g. by Getopt::Long::GetOptions(...); Requirements ============ Getopt::ArgvFile is tested with Perl versions 5.00[345]. It should run under later versions as well. Installation ============ This module could be installed as usual by perl Makefile.PL make make test make install If you are using perl 5.003, there is a bug in the core module Text::ParseWords which is used by Getopt::ArgvFile internally. This module cannot be installed separately, but the version in the 5.005 core works fine. So to fix the bug, simply update your perl core by replacing ParseWords.pm by its 5.005 version. (This is a tip of the packages author.) The 5.004 version should work, too, but I did not test it. Problems? ========= If you run into trouble with this module, feel free to contact me at jochen.stenzel@t-online.de. Author, Copyright, License ========================== Copyright (c) 1993-99 Jochen Stenzel. All rights reserved. This program is free software, you can redistribute it and/or modify it under the terms of the Artistic License distributed with Perl version 5.003 or (at your option) any later version. Please refer to the Artistic License that came with your Perl distribution for more details. The Artistic License should have been included in your distribution of Perl. It resides in the file named "Artistic" at the top-level of the Perl source tree (where Perl was downloaded/unpacked - ask your system administrator if you dont know where this is). Alternatively, the current version of the Artistic License distributed with Perl can be viewed on-line on the World-Wide Web (WWW) from the following URL: http://www.perl.com/perl/misc/Artistic.html Disclaimer ========== This software is distributed in the hope that it will be useful, but is provided "AS IS" WITHOUT WARRANTY OF ANY KIND, either expressed or implied, INCLUDING, without limitation, the implied warranties of MERCHANTABILITY and FITNESS FOR A PARTICULAR PURPOSE. The ENTIRE RISK as to the quality and performance of the software IS WITH YOU (the holder of the software). Should the software prove defective, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. IN NO EVENT WILL ANY COPYRIGHT HOLDER OR ANY OTHER PARTY WHO MAY CREATE, MODIFY, OR DISTRIBUTE THE SOFTWARE BE LIABLE OR RESPONSIBLE TO YOU OR TO ANY OTHER ENTITY FOR ANY KIND OF DAMAGES (no matter how awful - not even if they arise from known or unknown flaws in the software). Please refer to the Artistic License that came with your Perl distribution for more details.