1
0

ServiceModule.pm 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. ################################################################################
  2. # $Id: ServiceModule.pm 2880 2007-04-12 18:52:02Z b4rt $
  3. # $Date: 2007-04-12 13:52:02 -0500 (Thu, 12 Apr 2007) $
  4. # $Revision: 2880 $
  5. ################################################################################
  6. # #
  7. # LICENSE #
  8. # #
  9. # This program is free software; you can redistribute it and/or #
  10. # modify it under the terms of the GNU General Public License (GPL) #
  11. # as published by the Free Software Foundation; either version 2 #
  12. # of the License, or (at your option) any later version. #
  13. # #
  14. # This program is distributed in the hope that it will be useful, #
  15. # but WITHOUT ANY WARRANTY; without even the implied warranty of #
  16. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
  17. # GNU General Public License for more details. #
  18. # #
  19. # To read the license please visit http://www.gnu.org/copyleft/gpl.html #
  20. # #
  21. # #
  22. ################################################################################
  23. package ServiceModule;
  24. use strict;
  25. use warnings;
  26. ################################################################################
  27. ################################################################################
  28. # fields #
  29. ################################################################################
  30. # version in a var
  31. my $VERSION = "0.2";
  32. # state
  33. my $state = Fluxd::MOD_STATE_NULL;
  34. # message, error etc. keep it in one string for simplicity atm.
  35. my $message = "";
  36. ################################################################################
  37. # constructor + destructor #
  38. ################################################################################
  39. #------------------------------------------------------------------------------#
  40. # Sub: new #
  41. # Arguments: Null #
  42. # Returns: object reference #
  43. #------------------------------------------------------------------------------#
  44. sub new {
  45. my $class = shift;
  46. my $self = bless ({}, ref ($class) || $class);
  47. return $self;
  48. }
  49. #------------------------------------------------------------------------------#
  50. # Sub: destroy #
  51. # Arguments: Null #
  52. # Returns: Null #
  53. #------------------------------------------------------------------------------#
  54. sub destroy {
  55. # set state
  56. $state = Fluxd::MOD_STATE_NULL;
  57. # log
  58. Fluxd::printMessage("ServiceModule", "shutdown\n");
  59. }
  60. ################################################################################
  61. # public methods #
  62. ################################################################################
  63. #------------------------------------------------------------------------------#
  64. # Sub: initialize. this is separated from constructor to call it independent #
  65. # from object-creation. #
  66. # Arguments: null #
  67. # Returns: 0|1 #
  68. #------------------------------------------------------------------------------#
  69. sub initialize {
  70. Fluxd::printMessage("ServiceModule", "initializing\n");
  71. # set state
  72. $state = Fluxd::MOD_STATE_OK;
  73. # return
  74. return 1;
  75. }
  76. #------------------------------------------------------------------------------#
  77. # Sub: getVersion #
  78. # Arguments: null #
  79. # Returns: VERSION #
  80. #------------------------------------------------------------------------------#
  81. sub getVersion {
  82. return $VERSION;
  83. }
  84. #------------------------------------------------------------------------------#
  85. # Sub: getState #
  86. # Arguments: null #
  87. # Returns: state #
  88. #------------------------------------------------------------------------------#
  89. sub getState {
  90. return $state;
  91. }
  92. #------------------------------------------------------------------------------#
  93. # Sub: getMessage #
  94. # Arguments: null #
  95. # Returns: message #
  96. #------------------------------------------------------------------------------#
  97. sub getMessage {
  98. return $message;
  99. }
  100. #------------------------------------------------------------------------------#
  101. # Sub: set #
  102. # Arguments: Variable [value] #
  103. # Returns: #
  104. #------------------------------------------------------------------------------#
  105. sub set {
  106. }
  107. #------------------------------------------------------------------------------#
  108. # Sub: main #
  109. # Arguments: Null #
  110. # Returns: #
  111. #------------------------------------------------------------------------------#
  112. sub main {
  113. Fluxd::printMessage("ServiceModule", "main\n");
  114. }
  115. #------------------------------------------------------------------------------#
  116. # Sub: command #
  117. # Arguments: command-string #
  118. # Returns: result-string #
  119. #------------------------------------------------------------------------------#
  120. sub command {
  121. return "";
  122. }
  123. #------------------------------------------------------------------------------#
  124. # Sub: status #
  125. # Arguments: Null #
  126. # Returns: Status information #
  127. #------------------------------------------------------------------------------#
  128. sub status {
  129. return "\n-= ServiceModule Revision ".$VERSION." =-\n";
  130. }
  131. ################################################################################
  132. # make perl happy #
  133. ################################################################################
  134. 1;