NAME
Bio::Gonzales::Util::File - Utility functions for file stuff
SYNOPSIS
use Bio::Gonzales::Util::File qw(glob_regex expand_path slurpc basename open_on_demand is_newer);
DESCRIPTION
SUBROUTINES
- my ($fh, $was_already_open) = open_on_demand($filename_or_fh, $mode)
- my ($fh, $was_already_open) = openod($filename_or_fh, $mode)
-
Opens the file if
$filename_or_fhis a filename or returns$filename_or_fhif it is already a filehandle, that is opened. - my $fh = open_on_demand($filename, $mode)
- my $fh = openod($filename, $mode)
-
Opens the file
$filenameand returns an handle to it. - $true_if_a_is_newer = is_newer($a, $b)
-
Return true if
$bdoes not exist or$ais newer than$b. Dies if$adoes not exist. - ($dir, $basename, $suffix) = basename($file)
- $basename = basename($file)
-
Returns the basename of
$filein scalar context and the ($dir,$basename,$suffix) in list context. Filename example:/path/to/file.txt scalar basename: 'file' list basename: ('path/to', 'file', 'txt') - @lines = slurpc($file)
- @expanded = expand_path(@files)
- $expanded_ref = expand_path(@files)
-
Expands ~ in all supplied files and returns the crap.
- @files = glob_regex($dir, $file_regex)
-
Selects files from
$dirbased on the supplied$file_regex. - ($dirname, $filename) = splitpath($path)
-
Splits a $path into directory and filename.
SEE ALSO
AUTHOR
jw bargsten, <joachim.bargsten at wur.nl>