
# Main
#
# This Perl script lists the mounted pools on the server using the virtual file services for NetWare on Linux. 
#
{
	# Global Variables
	$file = "+</_admin/Manage_NSS/manage.cmd"; # This is the MSS management file we are accessing.
	$reply;	   # Variable used to read from file.
	$command; # This is the NSS xml command that will be the NSS request to the file.

	
		# Open the file and check that it exists.
		open(NSSFILE, $file) 
  			or die "Error opening NSS management file ($!) on server";
		print "file is now open \n";
	
		seek NSSFILE, 0, 0;
	
		$command = "<virtualIO><datastream name=\"command\"/></virtualIO><nssRequest><volume><listVolumes/></volume></nssRequest>"; # Initializing the virtual file for sending a command.
		print $file;
		print "\n";
		print $command;
		print "\n";
	
		syswrite(NSSFILE, $command, length($command)) #Initialize the nss management file and write a command.
			or die "Error writing initialization to management file.";
	
			
		seek NSSFILE, 0, 0;	  # Make sure to start at the beginning of the file.
		
		sysread (NSSFILE, $reply, 10000);  #Read the reply.
			print $reply;	 #Print the reply to the screen.
			print "\n";
			print "\n";
	
		close (NSSFILE);

	
}

   	
