#!/home/rebelsky/perl/bin/perl
#This program talks to the database by calling commands using 
#SimpleRPC->RPCClientCall.
#(POD documentation at end)

##################
# Package Begins #
##################
#Package ID
package Network;
use Exporter ();
@ISA = (Exporter);
@EXPORT = qw(writeFile appendFile readInFile fileExists delFile makeDir removeDir existsAndStore);

#import module
use SimpleRPC;

###########################################################################
# readInFile #
###########################################################################
# Reads the data from a file in the database
# ARGUMENTS: The file address of the file to be read in string form.
# RETURNS: The contents of the file in string form.
###########################################################################
sub readInFile
  {
    return RPCClientCall("cantor.math.grin.edu",7707,"readInFile",@_);
  }#sub readInFile

###########################################################################
# writeFile #
###########################################################################
# Stores a string in a specified file in the database
# ARGUMENTS: The file address in string form and the string to be stored 
# in the file
# RETURNS: Returns 1 to say that it ran correctly.
###########################################################################
sub writeFile
  {
    return RPCClientCall("cantor.math.grin.edu",7707,"writeFile",@_);
  }#sub writeFile

###########################################################################
# appendFile #
###########################################################################
# Appends a string to a specified file in the database
# ARGUMENTS: The file's address in string form and the string to be
# appended to the file
# RETURNS: Returns 1 to say that it ran correctly
###########################################################################
sub appendFile
  {
    return RPCClientCall("cantor.math.grin.edu",7707,"appendFile",@_);
  }#sub appendFile

###########################################################################
# fileExists #
###########################################################################
# Detemines whether a file exists in the database
# ARGUMENTS: The file's address in string form.
# RETURNS: Returns 1 if the file exists and 0 if it does not.
###########################################################################
sub fileExists
  {
    return RPCClientCall("cantor.math.grin.edu",7707,"fileExists",@_);
  }#sub fileExists

###########################################################################
# delFile #
###########################################################################
# Deletes a specified file from the database.
# ARGUMENTS: The address of the file to be deleted.
# RETURNS: Returns 1 to show that it worked.
###########################################################################
sub delFile
  {
    return RPCClientCall("cantor.math.grin.edu",7707,"delFile",@_);
  }#sub delFile

###########################################################################
# makeDir #
###########################################################################
# Makes a directory in the database.
# ARGUMENTS: The directory to be made in string form
# RETURNS: Returns 1 to show that it worked correctly
###########################################################################
sub makeDir
  {
    return RPCClientCall("cantor.math.grin.edu",7707,"makeDir",@_);
  }#sub makeDir

###########################################################################
# removeDir #
###########################################################################
# Deletes a directory from the database.
# ARGUMENTS: The directory to be deleted in string form.
# RETURNS: Returns 1 to show that it worked correctly.
###########################################################################
sub removeDir
  {
    return RPCClientCall("cantor.math.grin.edu",7707,"removeDir",@_);
  }#sub removeDir

###########################################################################
# existsAndStore #
###########################################################################
# Sees if a file exists and if it doesn't it stores specified string in it
# ARGUMENTS: The file address to check in string form and the data to put 
# in that file in string form.
# RETURNS: Returns 1 if the file exists and 0 if it did not and the data 
# was stored.
###########################################################################
sub existsAndStore
  {
    return RPCClientCall("cantor.math.grin.edu",7707,"existsAndStore",@_);
  }#sub existsAndStore

#####################
# Pod Documentation #
#####################
=pod

=head1 ID

=over 4

=item Package

Network.pm

=item Author

Rachel Heck

=item Description

This program talks to the database by calling commands using 
SimpleRPC->RPCClientCall.

=back

=head1 Subroutines

=over 4

=item writeFile

Stores a string in a specified file in the database.

=item appendFile

Appends a string to a specified file in the database.

=item readInFile

Reads the data from a file in the database.

=item fileExists

Detemines whether a file exists in the database.

=item delFile

Deletes a specified file from the database.

=item makeDir

Makes a directory in the database.

=item removeDir

Deletes a directory from the database.

=item existsAndStore

Sees if a file exists and if it doesn't it stores specified string in it

=back

=head1 History

=over 4

=item [13 July 1999]

writeFile, appendFile, readInFile, fileExists, delFile, makeDir, and  
removeDir are working and are fully commented.

=item [15 July 1999]

Added the subroutine existsAndStore.  The subroutine is working and is 
completely commented.

=item [20 July 1999]

The annotation server is now set up to run on cantor as opposed to erdos.

=back

=cut


