# # file: edgar-util.pl # auth: Brad Burdick # desc: general utilities for EDGAR processing # ########################################################################## # Copyright (c) 1994, 1995 Internet Multicasting Service # # The SEC EDGAR Level 1 Dissemination processing software ("software") # was developed by the Internet Multicasting Service and may # be used for academic, research, government, and internal business # purposes without charge. You may not resell this code or include it # in a product that you are selling without prior permission of the # Internet Multicasting Service. # # This software is provided ``as is'', without express or implied # warranty, and with no support nor obligation to assist in its # use, correction, modification or enhancement. We assume no liability # with respect to the infringement of copyrights, trade secrets, or any # patents, and are not responsible for consequential damages. Proper # use of the software is entirely the responsibility of the user. ########################################################################## # # get next consecutive file name based on input file name # - expects 'file01' format, may work with other formats # but could have *unexpected* results. # sub get_next_file { local($file) = shift; local(@tmp) = (); while ( -e $file ) { @tmp = split(/\./, $file); $tmp[$#tmp]++; $file = join('.', @tmp); } return $file; } # # make directory hierarchy as needed # sub makepath { local($path) = shift; local($mode) = shift; local($newpath) = ''; # assumes '/' as path delimiter foreach $dir (split(/\//, $path)) { $newpath .= "$dir/"; if (! -d $newpath) { mkdir($newpath, $mode); } } } # keep require happy 1;