Util::AttTool (version 0.0)


package Util::AttTool;
##############################################################################
#
# DESCRIPTION: This class provides an interface to external programs.
# DESCRIPTION: It handles error checking and logging and allows access
# DESCRIPTION: to all aspects of input and output to the program.
# DESCRIPTION: Any output to stderr or a non-zero exit status from the program
# DESCRIPTION: signals an error.
# DESCRIPTION: 
# DESCRIPTION: Sub-classes like Util::Ftool, Util::PseudoFtool, 
# DESCRIPTION: Util::Extractor, and Util::Stool give additional functionality
# DESCRIPTION: for specific types of programs.
#
# HISTORY: 
# HISTORY: $Log: AttTool.pm,v $
# HISTORY: Revision 1.3  2004/05/06 19:58:40  dah
# HISTORY: Add version number back into the header comments.
# HISTORY:
# HISTORY: Revision 1.2  2004/04/16 20:20:37  dah
# HISTORY: Begin using embedded history records
# HISTORY:
#
# VERSION: 0.0
#
#
##############################################################################

use Util::Tool;
@ISA=("Util::Tool");
use strict;

my $BIN;
my @LIBS = ();

sub new { 
    my $self      = shift;
    my $tool      = shift;

    ########################################
    # inherit the generic Tool constructor
    ########################################
    $self=$self->SUPER::new($BIN,$tool);

    $self->{LIBS} = \@LIBS;

    return $self;
}


sub dirs {
    my $self   = shift;
    $BIN       = shift;
    @LIBS      = @_;

    return $self;
}

#########################################################################
# return all shared object library directories for this software package
# These will be prepended to LD_LIBRARY_PATH when the tool is run
#########################################################################
sub libs {
    my $self=shift;

    return @{$self->{LIBS}};

}

sub init {
    my $self=shift;

    ############################
    # do the inherited init
    ############################
    $self->SUPER::init();

    #########################################################
    # set the LD_LIBRARY_PATH environment variable
    # to include all the shared object libraries
    # for this package. Remember the original value
    # so we can restore it after running the tool.
    #########################################################
    $self->{ORIGINAL_LD_LIBRARY_PATH}=$ENV{LD_LIBRARY_PATH};
    $ENV{LD_LIBRARY_PATH}=join(':', $self->libs()) . ":$ENV{LD_LIBRARY_PATH}";
}

sub cleanup {
    my $self=shift;

    #####################################
    # inherit generic tool cleanup stuff
    #####################################
    $self->SUPER::cleanup();

    #######################################
    # reset the path environment variables
    #######################################
    $ENV{LD_LIBRARY_PATH} = $self->{ORIGINAL_LD_LIBRARY_PATH};

}


1;