Joachim Bargsten > Bio-Gonzales-0.0543 > Bio::Gonzales::Util::File

Download:
Bio-Gonzales-0.0543.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.0101   Source   Latest Release: Bio-Gonzales-0.0544

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_fh is a filename or returns $filename_or_fh if it is already a filehandle, that is opened.

my $fh = open_on_demand($filename, $mode)
my $fh = openod($filename, $mode)

Opens the file $filename and returns an handle to it.

$true_if_a_is_newer = is_newer($a, $b)

Return true if $b does not exist or $a is newer than $b. Dies if $a does not exist.

($dir, $basename, $suffix) = basename($file)
$basename = basename($file)

Returns the basename of $file in 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 $dir based 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>

syntax highlighting: