1 |
#!/usr/bin/perl -w |
#!/usr/bin/perl -w |
2 |
############################################################################### |
############################################################################### |
3 |
# Meteor |
# Meteor |
4 |
# An HTTP server for the 2.0 web |
# An HTTP server for the 2.0 web |
5 |
# Copyright (c) 2006 contributing authors |
# Copyright (c) 2006 contributing authors |
6 |
# |
# |
7 |
# Subscriber.pm |
# Subscriber.pm |
8 |
# |
# |
9 |
# Description: |
# Description: |
10 |
# Meteor Configuration handling. |
# Meteor Configuration handling. |
11 |
# |
# |
12 |
# Main program should call Meteor::Config::setCommandLineParameters(@ARGV),. |
# Main program should call Meteor::Config::setCommandLineParameters(@ARGV),. |
13 |
# Afterwards anybody can access $::CONF{<parameterName>}, where |
# Afterwards anybody can access $::CONF{<parameterName>}, where |
14 |
# <parameterName> is any valid parameter (except 'Help') listed in the |
# <parameterName> is any valid parameter (except 'Help') listed in the |
15 |
# @DEFAULTS array below. |
# @DEFAULTS array below. |
16 |
# |
# |
17 |
############################################################################### |
############################################################################### |
18 |
# |
# |
19 |
# This program is free software; you can redistribute it and/or modify it |
# This program is free software; you can redistribute it and/or modify it |
20 |
# under the terms of the GNU General Public License as published by the Free |
# under the terms of the GNU General Public License as published by the Free |
21 |
# Software Foundation; either version 2 of the License, or (at your option) |
# Software Foundation; either version 2 of the License, or (at your option) |
22 |
# any later version. |
# any later version. |
23 |
# |
# |
24 |
# This program is distributed in the hope that it will be useful, but WITHOUT |
# This program is distributed in the hope that it will be useful, but WITHOUT |
25 |
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
26 |
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
27 |
# more details. |
# more details. |
28 |
# |
# |
29 |
# You should have received a copy of the GNU General Public License along |
# You should have received a copy of the GNU General Public License along |
30 |
# with this program; if not, write to the Free Software Foundation, Inc., |
# with this program; if not, write to the Free Software Foundation, Inc., |
31 |
# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
32 |
# |
# |
33 |
# For more information visit www.meteorserver.org |
# For more information visit www.meteorserver.org |
34 |
# |
# |
35 |
############################################################################### |
############################################################################### |
36 |
|
|
37 |
package Meteor::Config; |
package Meteor::Config; |
38 |
############################################################################### |
############################################################################### |
39 |
# Configuration |
# Configuration |
40 |
############################################################################### |
############################################################################### |
41 |
|
|
42 |
use strict; |
use strict; |
43 |
|
|
44 |
our @DEFAULTS=( |
our @DEFAULTS=( |
45 |
'Configuration file location on disk (if any)', |
'Template for each line in channelinfo. Placeholders are name, lastMsgID, subscriberCount, messageCount. Channel info is included in output when client does not give a message start index in its request (indicating it is the client\'s first request for that channel)', |
46 |
ConfigFileLocation => '/etc/meteord.conf', |
ChannelInfoTemplate => '<script>ch("~name~", ~lastMsgID~);</script>\r\n', |
47 |
|
|
48 |
'IP address for controller server (leave empty for all local addresses)', |
'Configuration file location on disk (if any)', |
49 |
ControllerIP => '', |
ConfigFileLocation => '/etc/meteord.conf', |
50 |
|
|
51 |
'Port number for controller connections', |
'IP address for controller server (leave empty for all local addresses)', |
52 |
ControllerPort => 4671, |
ControllerIP => '', |
53 |
|
|
54 |
'Controller Shutdown message, sent when the controller server shuts down (leave empty for no message)', |
'Port number for controller connections', |
55 |
ControllerShutdownMsg => '', |
ControllerPort => 4671, |
56 |
|
|
57 |
'Debug Flag, when set daemon will run in foreground and emit debug messages', |
'Controller Shutdown message, sent when the controller server shuts down (leave empty for no message)', |
58 |
Debug => 0, |
ControllerShutdownMsg => '', |
59 |
|
|
60 |
'Name of index file to serve when a directory is requested from the static file web server', |
'Debug Flag, when set daemon will run in foreground and emit debug messages', |
61 |
DirectoryIndex => 'index.html', |
Debug => 0, |
62 |
|
|
63 |
'Header to be served with static documents. ~server~ and ~status~ will be replaced by the appropriate values', |
'Name of index file to serve when a directory is requested from the static file web server', |
64 |
DocumentHeaderTemplate => 'HTTP/1.1 ~status~\r\nServer: ~server~\r\nContent-Type: text/html; charset=utf-8\r\n\r\n', |
DirectoryIndex => 'index.html', |
65 |
|
|
66 |
'Header template, ~server~, ~servertime~ and ~status~ will be replaced by the appropriate values. **NOTE**: It is possible to define more than one HeaderTemplate by appending a number at the end, for example *HeaderTemplate42*. Clients can request a specific header to be used by adding the parameter template=<number> to their GET request. If *HeaderTemplate<number>* is not found, the system will use the default HeaderTemplate (no number)', |
'Footer template', |
67 |
HeaderTemplate => 'HTTP/1.1 ~status~\r\nServer: ~server~\r\nContent-Type: text/html; charset=utf-8\r\nPragma: no-cache\r\nCache-Control: no-cache, no-store, must-revalidate\r\nExpires: Thu, 1 Jan 1970 00:00:00 GMT\r\n\r\n<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8">\r\n<meta http-equiv="Cache-Control" content="no-store">\r\n<meta http-equiv="Cache-Control" content="no-cache">\r\n<meta http-equiv="Pragma" content="no-cache">\r\n<meta http-equiv="Expires" content="Thu, 1 Jan 1970 00:00:00 GMT">\r\n<script type="text/javascript">\r\nwindow.onError = null;\r\nvar domainparts = document.domain.split(".");\r\ndocument.domain = domainparts[domainparts.length-2]+"."+domainparts[domainparts.length-1];\r\nparent.Meteor.register(this);\r\nparent.Meteor.setServerTime(~servertime~);\r\n</script>\r\n</head>\r\n<body onload="r()">\r\n', |
FooterTemplate => '</body></html>', |
68 |
|
|
69 |
'Print out this help message', |
'Header template, ~server~, ~servertime~ and ~status~ will be replaced by the appropriate values.', |
70 |
Help => '', |
HeaderTemplate => 'HTTP/1.1 ~status~\r\n\r\n~channelinfo~\r\n', |
71 |
|
|
72 |
'Maximum age of a message in seconds', |
'Print out this help message', |
73 |
MaxMessageAge => 7200, |
Help => '', |
74 |
|
|
75 |
'Maximum number of messages to send to a subscriber before forcing their connection to close. Use 0 to disable', |
'Format to use for timestamps in debug output: unix or human', |
76 |
MaxMessages => 0, |
LogTimeFormat => 'human', |
77 |
|
|
78 |
'Maximum number of stored messages per channel', |
'Maximum age of a message in seconds', |
79 |
MaxMessagesPerChannel => 250, |
MaxMessageAge => 7200, |
80 |
|
|
81 |
'Maximum duration in seconds for a subscriber connection to exist before forcing a it to close. Note that the server checks for expired connections in 60 second intervals, so small changes to this value will not have much of an effect. Use 0 to disable', |
'Whether to close subscriber connections once at least one message has been sent, and there are no further messages pending. 1 to enable, 0 to disable. Irrelevant unless Persist is set to 1.', |
82 |
MaxTime => 0, |
CloseOnEvent => 0, |
83 |
|
|
84 |
'Message template, ~text~, ~id~ and ~timestamp~ will be replaced by the appropriate values', |
'Maximum number of stored messages per channel', |
85 |
MessageTemplate => '<script>p(~id~,"~text~");</script>\r\n', |
MaxMessagesPerChannel => 250, |
86 |
|
|
87 |
'Interval at which PingMessage is sent to all persistent and identified subscriber connections (ie those including id=someuniqueidentifier in their request, and not specifying persist=0). Must be at least 3 if set higher than zero. Set to zero to disable.', |
'Maximum duration in seconds for a subscriber connection to exist before forcing a it to close. Note that the server checks for expired connections in 60 second intervals, so small changes to this value will not have much of an effect. Use 0 to disable', |
88 |
PingInterval => 5, |
MaxTime => 0, |
89 |
|
|
90 |
'Message to be sent to all persistent and identified subscriber connections (see above) every PingInterval seconds', |
'Message template, ~text~, ~id~, ~channel~ and ~timestamp~ will be replaced by the appropriate values', |
91 |
PingMessage => '<script>p(-1,"");</script>\r\n', |
MessageTemplate => '<script>p(~id~,"~channel~","~text~");</script>\r\n', |
92 |
|
|
93 |
'IP address for subscriber server (leave empty for all local addresses)', |
'Interval at which PingMessage is sent to all persistent subscriber connections. Must be at least 3 if set higher than zero. Set to zero to disable.', |
94 |
SubscriberIP => '', |
PingInterval => 5, |
95 |
|
|
96 |
'Port number for subscriber connections', |
'Persistence of a connection.', |
97 |
SubscriberPort => 4670, |
Persist => 0, |
98 |
|
|
99 |
'Subscriber Shutdown message, sent when the subscriber server shuts down (leave empty for no message)', |
'Message to be sent to all persistent subscriber connections (see above) every PingInterval seconds', |
100 |
SubscriberShutdownMsg => '<script>eof();</script>\r\n', |
PingMessage => '<script>p(-1,"");</script>\r\n', |
101 |
|
|
102 |
'An absolute filesystem path, to be used as the document root for Meteor\'s static file web server. If left empty, no documents will be served.', |
'IP address for subscriber server (leave empty for all local addresses)', |
103 |
SubscriberDocumentRoot => '/usr/local/meteor/public_html', |
SubscriberIP => '', |
104 |
|
|
105 |
'Since Meteor is capable of serving static pages from a document root as well as streaming events to subscribers, this paramter is used to specify the URI at which the event server can be reached. If set to the root, Meteor will lose the ability to serve static pages.', |
'Port number for subscriber connections', |
106 |
SubscriberDynamicPageAddress => '/push', |
SubscriberPort => 4670, |
107 |
|
|
108 |
'The syslog facility to use', |
'Subscriber Shutdown message, sent when the subscriber server shuts down (leave empty for no message)', |
109 |
SyslogFacility => 'daemon', |
SubscriberShutdownMsg => '<script>eof();</script>\r\n', |
110 |
); |
|
111 |
|
'An absolute filesystem path, to be used as the document root for Meteor\'s static file web server. If left empty, no documents will be served.', |
112 |
our %ConfigFileData=(); |
SubscriberDocumentRoot => '/usr/local/meteor/public_html', |
113 |
our %CommandLine=(); |
|
114 |
our %Defaults=(); |
'Since Meteor is capable of serving static pages from a document root as well as streaming events to subscribers, this parameter is used to specify the URI at which the event server can be reached. If set to the root, Meteor will lose the ability to serve static pages.', |
115 |
our %ExtraKeys=(); |
SubscriberDynamicPageAddress => '/push', |
116 |
|
|
117 |
for(my $i=0;$i<scalar(@DEFAULTS);$i+=3) |
'The syslog facility to use', |
118 |
{ |
SyslogFacility => 'daemon', |
119 |
$Defaults{$DEFAULTS[$i+1]}=$DEFAULTS[$i+2]; |
|
120 |
} |
'IP address for udp server (leave empty for all local addresses)', |
121 |
|
UDPIP => '', |
122 |
############################################################################### |
|
123 |
# Class methods |
'Port number for udp connections, set to 0 to disable', |
124 |
############################################################################### |
UDPPort => 0, |
125 |
sub updateConfig { |
|
126 |
my $class=shift; |
); |
127 |
|
|
128 |
%::CONF=(); |
our %ConfigFileData=(); |
129 |
|
our %CommandLine=(); |
130 |
my $debug=$class->valueForKey('Debug'); |
our %Defaults=(); |
131 |
|
our %Modes=(); |
132 |
print STDERR '-'x79 ."\nParamters:\nSource \tName and Value\n".'-'x79 ."\n" if($debug); |
|
133 |
|
for(my $i=0;$i<scalar(@DEFAULTS);$i+=3) |
134 |
my @keys=(); |
{ |
135 |
|
$Defaults{$DEFAULTS[$i+1]}=$DEFAULTS[$i+2]; |
136 |
for(my $i=0;$i<scalar(@DEFAULTS);$i+=3) |
} |
137 |
{ |
|
138 |
next if($DEFAULTS[$i+1] eq 'Help'); |
############################################################################### |
139 |
push(@keys,$DEFAULTS[$i+1]); |
# Class methods |
140 |
} |
############################################################################### |
141 |
push(@keys,keys %ExtraKeys); |
sub updateConfig { |
142 |
|
my $class=shift; |
143 |
foreach my $key (@keys) |
|
144 |
{ |
%::CONF=(); |
145 |
if(exists($CommandLine{$key})) |
|
146 |
{ |
my $debug=$class->valueForKey('Debug'); |
147 |
print STDERR "CmdLine" if($debug); |
|
148 |
$::CONF{$key}=$CommandLine{$key}; |
print STDERR '-'x79 ."\nMeteor server v$::VERSION (release date: $::RELEASE_DATE)\r\nLicensed under the terms of the GNU General Public Licence (2.0)\n".'-'x79 ."\n" if($debug); |
149 |
} |
|
150 |
elsif(exists($ConfigFileData{$key})) |
my @keys=(); |
151 |
{ |
|
152 |
print STDERR "CnfFile" if($debug); |
for(my $i=0;$i<scalar(@DEFAULTS);$i+=3) |
153 |
$::CONF{$key}=$ConfigFileData{$key}; |
{ |
154 |
} |
next if($DEFAULTS[$i+1] eq 'Help'); |
155 |
elsif(exists($Defaults{$key})) |
push(@keys,$DEFAULTS[$i+1]); |
156 |
{ |
} |
157 |
print STDERR "Default" if($debug); |
|
158 |
$::CONF{$key}=$Defaults{$key}; |
foreach my $mode ('',keys %Modes) |
159 |
} |
{ |
160 |
|
print STDERR ($mode) ? "\r\n$mode:\r\n" : "\r\nDefaults:\r\n" if($debug); |
161 |
print STDERR "\t$key\t$::CONF{$key}\n" if($debug); |
foreach my $baseKey (@keys) |
162 |
|
{ |
163 |
# Take care of escapes |
my $foundValue=0; |
164 |
$::CONF{$key}=~s/\\(.)/ |
my $key=$baseKey.$mode; |
165 |
if($1 eq 'r') |
|
166 |
{ |
if(exists($CommandLine{$key})) |
167 |
"\r"; |
{ |
168 |
} |
print STDERR "CmdLine" if($debug); |
169 |
elsif($1 eq 'n') |
$::CONF{$key}=$CommandLine{$key}; |
170 |
{ |
$foundValue=1; |
171 |
"\n"; |
} |
172 |
} |
elsif(exists($ConfigFileData{$key})) |
173 |
elsif($1 eq 's') |
{ |
174 |
{ |
print STDERR "CnfFile" if($debug); |
175 |
' '; |
$::CONF{$key}=$ConfigFileData{$key}; |
176 |
} |
$foundValue=1; |
177 |
elsif($1 eq 't') |
} |
178 |
{ |
elsif(exists($Defaults{$key})) |
179 |
"\t"; |
{ |
180 |
} |
print STDERR "Default" if($debug); |
181 |
else |
$::CONF{$key}=$Defaults{$key}; |
182 |
{ |
$foundValue=1; |
183 |
$1; |
} |
184 |
} |
|
185 |
/gex; |
next unless($foundValue); |
186 |
} |
|
187 |
|
print STDERR "\t$baseKey\t$::CONF{$key}\n" if($debug); |
188 |
print STDERR '-'x79 ."\n" if($debug); |
|
189 |
} |
# Take care of escapes |
190 |
|
$::CONF{$key}=~s/\\(.)/ |
191 |
sub valueForKey { |
if($1 eq 'r') { |
192 |
my $class=shift; |
"\r"; |
193 |
my $key=shift; |
} elsif($1 eq 'n') { |
194 |
|
"\n"; |
195 |
return $CommandLine{$key} if(exists($CommandLine{$key})); |
} elsif($1 eq 's') { |
196 |
return $ConfigFileData{$key} if(exists($ConfigFileData{$key})); |
' '; |
197 |
|
} elsif($1 eq 't') { |
198 |
$Defaults{$key}; |
"\t"; |
199 |
} |
} elsif($1 eq '0') { |
200 |
|
"\0"; |
201 |
sub setCommandLineParameters { |
} else { |
202 |
my $class=shift; |
$1; |
203 |
|
} |
204 |
while(my $cnt=scalar(@_)) |
/gex; |
205 |
{ |
} |
206 |
my $k=shift(@_); |
} |
207 |
&usage("'$k' invalid") unless($k=~s/^\-(?=.+)//); |
print STDERR '-'x79 ."\n" if($debug); |
208 |
|
} |
209 |
$k='Debug' if($k eq 'd'); |
|
210 |
|
sub valueForKey { |
211 |
my $key=undef; |
my $class=shift; |
212 |
my $kl=length($k); |
my $key=shift; |
213 |
my $kOrig=$k; |
|
214 |
$k=lc($k); |
return $CommandLine{$key} if(exists($CommandLine{$key})); |
215 |
|
return $ConfigFileData{$key} if(exists($ConfigFileData{$key})); |
216 |
for(my $i=0;$i<scalar(@DEFAULTS);$i+=3) |
|
217 |
{ |
$Defaults{$key}; |
218 |
my $p=$DEFAULTS[$i+1]; |
} |
219 |
my $pl=length($p); |
|
220 |
|
sub setCommandLineParameters { |
221 |
next if($kl>$pl); |
my $class=shift; |
222 |
|
|
223 |
#print "$kl $pl $k $p\n"; |
# |
224 |
|
# Quick check if we should show the version, if so ignore everything else |
225 |
if($kl==$pl && $k eq lc($p)) |
# Accept -v, -version, and everything in between |
226 |
{ |
# |
227 |
$key=$p; |
foreach my $p (@_) |
228 |
last; |
{ |
229 |
} |
if(index($p,'-v')==0 && index('-version',$p)==0) |
230 |
|
{ |
231 |
my $ps=lc(substr($p,0,$kl)); |
print "$::PGM $::VERSION\n"; |
232 |
|
exit(0); |
233 |
if($k eq $ps) |
} |
234 |
{ |
} |
235 |
if(defined($key)) |
|
236 |
{ |
while(my $cnt=scalar(@_)) |
237 |
&usage("Ambigous parameter name '$kOrig'"); |
{ |
238 |
} |
my $k=shift(@_); |
239 |
$key=$p; |
&usage("'$k' invalid") unless($k=~s/^\-(?=.+)//); |
240 |
} |
|
241 |
} |
$k='Debug' if($k eq 'd'); |
242 |
|
|
243 |
if($k=~/^HeaderTemplate(\d+)$/i) |
my $mode=''; |
244 |
{ |
|
245 |
$key="HeaderTemplate$1"; |
if($k=~s/(\.(.+))$//) |
246 |
$ExtraKeys{$key}=1; |
{ |
247 |
} |
$mode=$2; |
248 |
|
$Modes{$mode}=1; |
249 |
&usage("Unknown parameter name '$kOrig'") unless(defined($key)); |
} |
250 |
|
|
251 |
&usage() if($key eq 'Help'); |
my $key=undef; |
252 |
|
my $kl=length($k); |
253 |
#print "$kOrig: $key\n"; |
my $kOrig=$k; |
254 |
|
$k=lc($k); |
255 |
$CommandLine{$key}=1; |
|
256 |
|
for(my $i=0;$i<scalar(@DEFAULTS);$i+=3) |
257 |
if($cnt>1 && $_[0]!~/^\-(?!\-)/) |
{ |
258 |
{ |
my $p=$DEFAULTS[$i+1]; |
259 |
my $param=shift; |
my $pl=length($p); |
260 |
$param=~s/^\-\-/\-/; |
|
261 |
$CommandLine{$key}=$param; |
next if($kl>$pl); |
262 |
} |
|
263 |
} |
#print "$kl $pl $k $p\n"; |
264 |
|
|
265 |
$class->readConfig(); |
if($kl==$pl && $k eq lc($p)) |
266 |
|
{ |
267 |
$class->updateConfig(); |
$key=$p; |
268 |
} |
last; |
269 |
|
} |
270 |
sub readConfig { |
|
271 |
my $class=shift; |
my $ps=lc(substr($p,0,$kl)); |
272 |
|
|
273 |
%ConfigFileData=(); |
if($k eq $ps) |
274 |
|
{ |
275 |
my $path=$class->valueForKey('ConfigFileLocation'); |
if(defined($key)) |
276 |
return unless(defined($path) && -f $path); |
{ |
277 |
|
&usage("Ambigous parameter name '$kOrig'"); |
278 |
open(CONFIG,"$path") or &usage("Config file '$path' for read: $!\n"); |
} |
279 |
while(<CONFIG>) |
$key=$p; |
280 |
{ |
} |
281 |
next if(/^\s*#/); |
} |
282 |
next if(/^\s*$/); |
|
283 |
|
&usage("Unknown parameter name '$kOrig'") unless(defined($key)); |
284 |
s/[\r\n]*$//; |
|
285 |
|
&usage() if($key eq 'Help'); |
286 |
unless(/^(\S+)\s*(.*)/) |
|
287 |
{ |
#print "$kOrig: $key\n"; |
288 |
&usage("Invalid configuration file parameter line '$_'"); |
|
289 |
} |
$CommandLine{"$key$mode"}=1; |
290 |
|
|
291 |
my $key=$1; |
if($cnt>1 && $_[0]!~/^\-(?!\-)/) |
292 |
my $val=$2; |
{ |
293 |
$val='' unless(defined($val)); |
my $param=shift; |
294 |
|
$param=~s/^\-\-/\-/; |
295 |
if($key=~/^HeaderTemplate\d+$/) |
$CommandLine{"$key$mode"}=$param; |
296 |
{ |
} |
297 |
$ExtraKeys{$key}=1; |
} |
298 |
} |
|
299 |
else |
$class->readConfig(); |
300 |
{ |
|
301 |
unless(exists($Defaults{$key})) |
$class->updateConfig(); |
302 |
{ |
} |
303 |
&usage("Unknown configuration file parameter name '$key'"); |
|
304 |
} |
sub readConfig { |
305 |
if($key eq 'ConfigFileLocation') |
my $class=shift; |
306 |
{ |
|
307 |
&usage("'ConfigFileLocation' parameter not allowed in configuration file!"); |
%ConfigFileData=(); |
308 |
} |
|
309 |
} |
my $path=$class->valueForKey('ConfigFileLocation'); |
310 |
|
return unless(defined($path) && -f $path); |
311 |
$val=~s/^--/-/; |
|
312 |
|
my $mode=''; |
313 |
$ConfigFileData{$key}=$val; |
|
314 |
} |
open(CONFIG,"$path") or &usage("Config file '$path' for read: $!\n"); |
315 |
close(CONFIG); |
while(<CONFIG>) |
316 |
} |
{ |
317 |
|
next if(/^\s*#/); |
318 |
sub usage { |
next if(/^\s*$/); |
319 |
my $msg=shift || ''; |
|
320 |
|
s/[\r\n]*$//; |
321 |
if($msg) { |
|
322 |
print STDERR <<"EOT"; |
if(/^\s*\[\s*([^\]\s]+)\s*\]\s*$/) |
323 |
$msg; |
{ |
324 |
For further help type $::PGM -help |
$Modes{$1}=1; |
325 |
or consult docs at http://www.meteorserver.org/ |
$mode = $1; |
326 |
EOT |
next; |
327 |
|
} |
328 |
} else { |
|
329 |
|
unless(/^(\S+)\s*(.*)/) |
330 |
|
{ |
331 |
print STDERR <<"EOT"; |
&usage("Invalid configuration file parameter line '$_'"); |
332 |
|
} |
333 |
Meteor server v1.0 (release date: 1 Dec 2006) |
|
334 |
Licensed under the terms of the GNU General Public Licence (2.0) |
my $key=$1; |
335 |
|
my $val=$2; |
336 |
Usage: |
$val='' unless(defined($val)); |
337 |
|
|
338 |
$::PGM [-parameter [value] [-parameter [value]...]] |
unless(exists($Defaults{$key})) |
339 |
|
{ |
340 |
Accepted command-line parameters: |
&usage("Unknown configuration file parameter name '$key$mode'"); |
341 |
|
} |
342 |
EOT |
if($key eq 'ConfigFileLocation') |
343 |
|
{ |
344 |
for(my $i=0;$i<scalar(@DEFAULTS);$i+=3) |
&usage("'ConfigFileLocation' parameter not allowed in configuration file!"); |
345 |
{ |
} |
346 |
print STDERR "-$DEFAULTS[$i+1]\n$DEFAULTS[$i].\n\n"; |
|
347 |
} |
$val=~s/^--/-/; |
348 |
|
|
349 |
print STDERR <<"EOT"; |
$ConfigFileData{"$key$mode"}=$val; |
350 |
|
} |
351 |
Any of the parameters listed above can also be configured in the |
close(CONFIG); |
352 |
configuration file. The default location for this file is: |
} |
353 |
|
|
354 |
$Defaults{'ConfigFileLocation'} |
sub usage { |
355 |
|
my $msg=shift || ''; |
356 |
For more information and complete documentation, see the Meteor |
|
357 |
website at http://www.meteorserver.org/ |
if($msg) { |
358 |
EOT |
print STDERR <<"EOT"; |
359 |
|
$msg; |
360 |
} |
For further help type $::PGM -help |
361 |
exit(1); |
or consult docs at http://meteorserver.org/ |
362 |
} |
EOT |
363 |
|
|
364 |
1; |
} else { |
365 |
|
|
366 |
|
|
367 |
|
print STDERR <<"EOT"; |
368 |
|
|
369 |
|
Meteor server v$::VERSION (release date: $::RELEASE_DATE) |
370 |
|
Licensed under the terms of the GNU General Public Licence (2.0) |
371 |
|
|
372 |
|
Usage: |
373 |
|
|
374 |
|
$::PGM [-parameter [value] [-parameter [value]...]] |
375 |
|
|
376 |
|
Accepted command-line parameters: |
377 |
|
|
378 |
|
EOT |
379 |
|
|
380 |
|
for(my $i=0;$i<scalar(@DEFAULTS);$i+=3) |
381 |
|
{ |
382 |
|
print STDERR "-$DEFAULTS[$i+1]\n$DEFAULTS[$i].\n\n"; |
383 |
|
} |
384 |
|
|
385 |
|
print STDERR <<"EOT"; |
386 |
|
|
387 |
|
Any of the parameters listed above can also be configured in the |
388 |
|
configuration file. The default location for this file is: |
389 |
|
|
390 |
|
$Defaults{'ConfigFileLocation'} |
391 |
|
|
392 |
|
For more information and complete documentation, see the Meteor |
393 |
|
website at http://meteorserver.org/ |
394 |
|
EOT |
395 |
|
|
396 |
|
} |
397 |
|
exit(1); |
398 |
|
} |
399 |
|
|
400 |
|
1; |
401 |
############################################################################EOF |
############################################################################EOF |