home *** CD-ROM | disk | FTP | other *** search
/ CD Actual Thematic 7: Programming / CDAT7.iso / Share / Editores / Perl5 / perl / lib / site / Win32 / Service.pm < prev    next >
Encoding:
Perl POD Document  |  1997-08-10  |  2.1 KB  |  109 lines

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