# # file: scs_if.pm # # Description: Source Control System # this object is meant to represent all the generic operations # for source control. It isn't abstract, but all it's member # functions just cause a die... # # # created: Fri Apr 24 10:54:07 EDT 1998 Kyle R. Burton # # revision list: # Sat May 2 14:54:18 EDT 1998 KRB - implemented param(), and process_conf() # # use Exporter; package scs_if; @ISA = ( 'Exporter', 'scs_if' ); @EXPORT = ( ); @EXPORT_OK = ( ); my $conf = "/etc/net_sccs.conf"; my $debug = 0; sub new { my($pkg) = shift; my($type) = shift; $rthis = new $type; $rthis->process_conf(); return $rthis; } sub add { my($obj) = shift; print "Error, scs_if::add ins't implemented, sublcass scs_if and implement " . "add for your source control system.\n"; } sub get { my($obj) = shift; print "Error, scs_if::get isn't implemented, subclass scs_if and implement " . "get for your source control system.\n"; } sub checkout { my($obj) = shift; print "Error, scs_if::checkout isn't implemented, subclass scs_if and " . "implement get for your source control system.\n"; } sub checkin { my($obj) = shift; print "Error, scs_if::checkin isn't implemented, subclass scs_if and implement " . "get for your source control system.\n"; } sub diff { my($obj) = shift; print "Error, scs_if::diff isn't implemented, subclass scs_if and implement " . "get for your source control system.\n"; } sub param { my($obj) = shift; my($param) = shift; print "scs_if::param($param)\n" if $debug; if( defined( $obj{$param} ) ) { return $obj{$param}; } return undef; } sub process_conf { my $obj = shift; print "processing conf file...\n" if $debug; if( open( CONF, "<$conf" ) ) { print "conf file opened...\n" if $debug; while( $line = ) { chomp $line; print "read line: $line\n" if $debug; # use a trailing \ for line continuation while( $line =~ /\\$/ ) { $line =~ s/\\$//; $line .= ; chomp $line; } # strip out comments $line =~ s/#.*$//; # skip blank lines next if $line =~ /^\s*$/; if( $line =~ /^\s*(\S+)\s+(.*)$/ ) { print "setting: $1=$2\n" if $debug; if( defined $obj{$1} ) { print "Error in $conf file, $1 is either reserved, " . "or already defined.\n"; } $obj{$1} = $2; } } close( CONF ); } else { print "Error opening conf file: $conf $!\n"; return undef; } print "completed processing of conf file.\n" if $debug; } 1;