Test::AutoBuild::Lib.3pm

Langue: en

Autres versions - même langue

Version: 2007-12-08 (fedora - 01/12/10)

Section: 3 (Bibliothèques de fonctions)

NAME

Test::AutoBuild::Lib - A library of useful routines

SYNOPSIS

   use Test::AutoBuild::Lib;
 
   my \@sorted_modules = Test::AutoBuild::Lib::sort_modules(\@modules);
 
   my \%packages = Test::AutoBuild::Lib::package_snapshot($package_types);
   my \%newpackages = Test::AutoBuild::Lib::new_packages(\%before, \%after);
 
   my $string = Test::AutoBuild::Lib::pretty_size($bytes);
   my $string = Test::AutoBuild::Lib::pretty_date($seconds);
   my $string = Test::AutoBuild::Lib::pretty_time($seconds);
 
 

DESCRIPTION

The Test::AutoBuild::Lib module provides a library of routines that are shared across many different modules.

METHODS

my %packages = Test::AutoBuild::Lib::new_packages(\%before, \%after);
Compares the sets of packages defined by the "before" and "after" package snapshots. The returned hash ref will have entries for any files in "after", but not in "before", or any files which were modified between "before" and "after" snapshots.
my $string = Test::AutoBuild::Lib::pretty_date($seconds);
Formats the time specified in the "seconds" parameter to follow the style ``Wed Jan 14 2004 21:45:23 UTC''.
my $string = Test::AutoBuild::Lib::pretty_time($seconds);
Formats an interval in seconds for friendly viewing according to the style ``2h 27m 12s'' - ie 2 hours, 27 minutes and 12 seconds.
my $string = Test::AutoBuild::Lib::pretty_size($bytes);
Formats the size specified in the "bytes" parameter for friendly viewing. If the number of bytes is > 1024x1024 then it formats in MB, with 2 decimal places. Else if the number of bytes is > 1024 it formats in kb with 2 decimal places. Otherwise it just formats as bytes.
my $status = Test::AutoBuild::Lib::run($comnand, \%env);
Executes the program specified in the "command" argument. The returned value is the output of the commands standard output stream. Prior to running the command, the environment variables specified in the "env" parameter are set. This environment is modified locally, so the changes are only in effect for the duration of this method.
($config, $fh, $error) = Test::AutoBuild::Lib::load_template_config($file, [\%vars])
This method loads the content of the configuration file $file, passes it through the Template module, and then creates an instance of the Config::Record module. The second optiona %vars parameter is a hash reference containing a set of variables which will be passed through to the templating engine. A 3 element list is returned, the first element containing the Config::Record object, the second a scalar containing the post-processed configuration file, the last containing any error message generated.

AUTHORS

Daniel Berrange <dan@berrange.com>, Dennis Gregorovic <dgregorovic@alum.mit.edu> Copyright (C) 2002-2005 Daniel Berrange <dan@berrange.com>

SEE ALSO

perl(1), Test::AutoBuild, Test::AutoBuild::Runtime, Template, Config::Record