home *** CD-ROM | disk | FTP | other *** search
/ c't freeware shareware 1997 / CT_SW_97.ISO / pc / software / entwickl / win95 / pw32i306.exe / lib / Win32 / service.pm < prev    next >
Text File  |  1996-10-14  |  2KB  |  105 lines

  1. package Win32::Service;
  2.  
  3. #
  4. #Service.pm
  5. #Written by Douglas_Lankshear@ActiveWare.com
  6. #
  7.  
  8. require Exporter;
  9. require DynaLoader;
  10.  
  11. die "The Win32::Service module works only on Windows NT" if(!Win32::IsWinNT());
  12.  
  13. @ISA= qw( Exporter DynaLoader );
  14. # Items to export into callers namespace by default. Note: do not export
  15. # names by default without a very good reason. Use EXPORT_OK instead.
  16. # Do not simply export all your public functions/methods/constants.
  17. @EXPORT = qw(
  18.     );
  19.  
  20. =head1 NAME
  21.  
  22. Win32::Service - manage system services in perl
  23.  
  24. =head1 SYNOPSIS
  25.  
  26.     use Win32::Service;
  27.  
  28. =head1 DESCRIPTION
  29.  
  30. This module offers control over the administration of system services.
  31.  
  32. =head1 FUNCTIONS
  33.  
  34. =head2 NOTE:
  35. all of the functions return FALSE (0) if they fail, unless otherwise noted.
  36. hostName is optional for all the calls below. (if not given the local machine is assumed.)
  37.  
  38. =over 10
  39.  
  40. =item StartService(hostName, serviceName)
  41.     Start the service serviceName on machine hostName
  42.  
  43. =item StopService(hostName, serviceName)
  44.     Stop the service serviceName on the machine hostName
  45.  
  46. =item GetStatus(hostName, serviceName, status) 
  47.     Get the status of a service
  48.  
  49. =item PauseService(hostName, serviceName)
  50.  
  51. =item ResumeService(hostName, serviceName)
  52.  
  53. =item GetServices(hostName, list) 
  54.  
  55. =back
  56.  
  57. =cut
  58.  
  59. sub AUTOLOAD
  60. {
  61.     # This AUTOLOAD is used to 'autoload' constants from the constant()
  62.     # XS function.  If a constant is not found then control is passed
  63.     # to the AUTOLOAD in AutoLoader.
  64.  
  65.     my($constname);
  66.     ($constname = $AUTOLOAD) =~ s/.*:://;
  67.     #reset $! to zero to reset any current errors.
  68.     $!=0;
  69.     my $val = constant($constname, @_ ? $_[0] : 0);
  70.     if($! != 0)
  71.     {
  72.         if($! =~ /Invalid/)
  73.         {
  74.             $AutoLoader::AUTOLOAD = $AUTOLOAD;
  75.             goto &AutoLoader::AUTOLOAD;
  76.         }
  77.         else
  78.         {
  79.             ($pack,$file,$line) = caller;
  80.             die "Your vendor has not defined Win32::Service macro $constname, used in $file at line $line.";
  81.         }
  82.     }
  83.     eval "sub $AUTOLOAD { $val }";
  84.     goto &$AUTOLOAD;
  85. }
  86.  
  87. bootstrap Win32::Service;
  88.  
  89. # Preloaded methods go here.
  90.  
  91. # Autoload methods go after __END__, and are processed by the autosplit program.
  92.  
  93. 1;
  94. __END__
  95.     
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.