package ParseFiles; #use strict; use vars qw(@ISA @EXPORT $VERSION); use Exporter; $VERSION = 0.01; @ISA = qw(Exporter); @EXPORT = qw(&wad_parsefiles); $VERSION = 0.01; sub wad_parsefiles (@); ################################################### # sub parsefiles - args (@file list) return (@expanded file list) # take a list of filename arguments and expand it to a full # list, with wildcards globbed and @filelists opened # and included sub wad_parsefiles { my ($filespec, @files, @readfile); foreach $filespec (@_) { # convert drive:\dir\file to drive:\\dir\\file to make perl happy $filespec =~ s/\\/\\\\/g; # check if arg begins w/ "@", treat as list if so if ( $filespec =~ /^@/ ) { # remove leading @ $filespec =~ s/^@//; # open the list and dump contents into @files if (open(FILELIST, "$filespec")){ @readfile = ; chomp(@readfile); close(FILELIST); @files = (@files, @readfile); } } # glob it? elsif ( $filespec =~ /\*/ || $filespec =~ /\?/ ) { @files = (@files, glob("$filespec")); } else { @files = (@files, "$filespec"); } } return @files; }