This class allows you to do a number of useful things with
a list of files.
Sub-classes such as Util::FITSlist and Util::EventFileList
add additional funtionality for specific types of files.
Constructor
- new(file1, file2, file3 ...)
Accessors
- add(file)
Append a file to the end of the list.
- files()
Returns an array containing all the file names.
- count()
Returns the number of files in the list.
- file(index)
Returns the name of the index-th file in the list.
- files_for_param()
Returns the names of all the files in a form suitable for
use in an FTOOL parameter.
See the "as_param" method.
Note this is the same as the "files" method
but it is separate to allow subclasses to override it.
- tmp_file_suffix()
Get or set the name of the unique suffix used for temporary file names.
Methods
- as_param()
Give the list of files in a form suitable for use as an input parameter
to an FTOOL. First tries to format the files as a space-separated
list. If the length of this string is longer than $self->{MAX_PARAM_LENGTH}
it dumps the file names to an ascii file and returns the name of that
file preceeded by "@". This is a standard FTOOL convention.
The temporary file is deleted when this object is destroyed, so
it will generally be necessary to explicitly call the DESTROY method
to force the list file to stick around long enough to be used.
- merge(merged)
Merge all the files in the list into a single file
and return the name of the merged file.
If the list contains only one file this method does nothing and returns
the name of that one file.
This method simply concatenates the files. Subclasses override this method.
- sublist(from, to)
Create a new list which is a subset of this one.
The arguments are the index of the first and last files in the list.
The index of the first file is zero.
- If $to is beyond the end of the list, it is reduced to the end of the list
- If $from is beyond the end of the list or $from >$to, undef is returned.
- If $from==0 and $to is at or beyond the end of the list, a reference
to this same object is returned.
.
- delete(log, message)
Delete all the files in the list.
If a log object and an message string are given, that message will be
logged if any files are removed.
- tar(tarfile)
Make a tar file containing all the files in the list.
Special Methods
- DESTROY()
Destructor - deletes temporary file list. This method should probably be
called explicitly after using the as_param method.