Changeset 27421


Ignore:
Timestamp:
2013-05-24T09:38:05+12:00 (11 years ago)
Author:
jmt12
Message:

Fixing bug in filePutContents (wasn't shifting parameters off front of @_, but then was readding them), adding canRead(), and changing some comment formatting

File:
1 edited

Legend:

Unmodified
Added
Removed
  • gs2-extensions/parallel-building/trunk/src/perllib/FileUtils.pm

    r27384 r27421  
    4040my $debug = 0;
    4141
    42 # /** @function _callFunction($driver_name, $function_name, ...)
    43 #  *  Make a function call to a dynamically loaded database driver.
    44 #  *  @param $driver_name - The name of the file protocol driver to load
    45 #  *  @param $function_name - The function within the driver to call
    46 #  *  @param <rest> - The parameters to be passed to the function called
    47 #  */
     42## @function _callFunction($driver_name, $function_name, ...)
     43#
     44# Make a function call to a dynamically loaded database driver.
     45# @param $driver_name - The name of the file protocol driver to load
     46# @param $function_name - The function within the driver to call
     47# @param <rest> - The parameters to be passed to the function called
     48#
    4849sub _callFunction
    4950{
     
    7172  return $result;
    7273}
    73 # /** callFunction() **/
    74 
    75 # /** @function _prettyPrint($type, ...)
    76 #  *  Print a debugging message to STDERR constructed from the <rest> based
    77 #  *  upon the type.
    78 #  *  @param type - If 0, output the start of a function with a listing of its
    79 #  *                parameters. If 1, output the result of a function. 2 is
    80 #  *                used for function errors. Default to simply printing what-
    81 #  *                ever else is in <rest>
    82 #  */
     74## callFunction()
     75
     76## @function _prettyPrint()
     77#
     78# Print a debugging message to STDERR constructed from the <rest> based upon
     79# the type.
     80# @param type - If 0, output the start of a function with a listing of its
     81#               parameters. If 1, output the result of a function. 2 is
     82#               used for function errors. Default to simply printing what-
     83#               ever else is in <rest>
     84#
    8385sub _prettyPrint
    8486{
     
    144146  print STDERR "[" . time() . "] " . $message . "\n";
    145147}
    146 # /** _prettyPrint($type, $function, $message) **/
     148## _prettyPrint()
    147149
    148150# /** @function _determineDriver()
     
    384386sub filePutContents
    385387{
    386   my ($path, $str) = @_;
     388  my $path = shift(@_);
     389  my $str = shift(@_);
    387390  my $driver = &FileUtils::_determineDriver($path);
    388391  my $fh;
     
    414417sub canRead
    415418{
    416   my ($path) = @_;
    417   my $driver = &FileUtils::_determineDriver($path);
    418   return &FileUtils::_callFunction($driver, 'fileTest', $path, '-R');
     419  my $path = shift(@_);
     420  my $driver = &FileUtils::_determineDriver($path);
     421  return &FileUtils::_callFunction($driver, 'canRead', $path, @_);
    419422}
    420423## canRead()
     
    487490# /** fileSize() **/
    488491
    489 # /**
    490 #  */
     492## @function hardLink()
     493#
    491494sub hardLink
    492495{
     
    512515  }
    513516}
    514 # /** hardLink() **/
     517## hardLink()
     518
    515519
    516520## @function isFilenameAbolsute()
     
    525529}
    526530## isFilenameAbsolute()
     531
    527532
    528533## @function isSymbolicLink()
Note: See TracChangeset for help on using the changeset viewer.