# Perl module to add usage reporting to any program run from within a perl 
# wrapper
#
# Usage;
#	require 'Usage.pm';

# $Id: Usage.pm,v 1.3 2002/02/21 17:26:18 rmd Exp $
# $Log: Usage.pm,v $
# Revision 1.3  2002/02/21  17:26:18  rmd
# Commented out all code for the database move.
#
# Revision 1.2  1997/11/07  12:37:37  dn1
# no change
#

#
# (no further code is required in the calling script)
#
# SJM, 3.9.97
#
# Main ---------------------------------------------------------------------


BEGIN {
## Takes the project and program name, and returns the usage ID for this process
## Errors should happen silently and so not affect operation of the script 
## from which this is called
#
#	use DBI;
#
## Configuration -------------------------------------------
#
#	$db_database = 'sids';	# database name
#	$db_user = 'usage';		# database username
#	$db_pass = 'usage';		# database password
#	$ENV{'ORACLE_HOME'} = '/usr/local/oracle';
#
## ---------------------------------------------------------
#
#	chomp($u_acct = `whoami`);		# account name
#	chomp($u_host = `uname -n`);	# host name
#	$u_prog = $0;					# script name
#	$u_args = join(' ',@ARGV);		# script arguments
#
#	if ($dbh = DBI->connect( $db_database, $db_user, $db_pass, 'Oracle')) {
#		$sth = $dbh->prepare("BEGIN usage_master.add_record(\'$u_acct\',\'$u_prog\',\'$u_host\',\'$u_args\',:1); END;");
#		$sth->bind_param_inout(1, \$u_id,10);
#		$sth->execute;
#		$sth->finish;
#		$dbh->disconnect;
#		$u_id;
#	} else {
#		$u_id = 0;
#	}
}

END {
#	&check_out($u_id);
}

# Subroutines --------------------------------------------------------------

sub check_out {
## Takes a usage ID and records in the database when this program terminated
## this will die if there are errors
#
#	local($input_id) = @_;
#
#	$dbh = DBI->connect( $db_database, $db_user, $db_pass, 'Oracle') || die "Could not log in to usage database ----> Please inform bug.";
#	$sth = $dbh->prepare("BEGIN usage_master.upd_record(\'$input_id\'); END;");
#	$sth->execute || die "$DBI::errstr";
#	$sth->finish;
#	$dbh->disconnect;
}

1;	# for perl



