PROXY  WHOIS  RQUOTE  TEXTS  SOFT  FOREX  BBOARD
 Music  Philosophy  Code  Literature  Russian

= ROOT|Technical|Code_Examples|Perl|Proxy|HoTTProxy|HoTTProxy_Admin.pl =

page 1 of 1



use warnings;
use strict;

use HoTTProxy::UI;

# We need the path to the present executable.  Under Win32 this is pretty 
# positive using the Win32::GetFullPathName.  Under Linux and the like, 
# it looks like $ENV{'PWD'} will get us what we want - suggestions?
my $path;
my %HoTTProxyAdminConfig;	# Will hold any configurable settings
my $HoTTProxyAdminVersion = '0.24.0.0';

print STDERR "\nHoTTProxy Admin Daemon $HoTTProxyAdminVersion - (c) 2005 Brian A. Blakley\n\n";

if ($^O eq 'MSWin32') {
	$path = Win32::GetFullPathName( $0 );
	($path) = $path =~ m/^(.*\\)/;	# e.g. C:\data\programming\Perl\HoTTProxy (with trailing slash)
} else {
	$path = $ENV{'PWD'};
	if (not $path =~ m/\/$/) {		# if the path doesn't end with a frontslash, make it so
		$path .= '/';
	}
}

loadConfig('HoTTProxy_Admin.conf');

my $server = HoTTProxy::UI->new();
$server->port($HoTTProxyAdminConfig{'AdminPort'});
$server->basepath($path);
$server->wwwpath($path . 'www');
$server->run();

sub loadConfig {
	my $configFile = shift;
	if (not open (CONFIG,"$path/$configFile")) {
		die "Cannot open config file $configFile.\nError: $!\nEnding.\n";
	}
	while (<CONFIG>) {
		chomp $_;
		if ($_ =~ m/^#/) {		# if the line starts with a # character
			# do nothing, this is a comment line
		} elsif ($_) {
			my ($name,$value) = $_ =~ m/^([^=]*) = (.*)$/;	# e.g. AdminPort = 8085
			$HoTTProxyAdminConfig{$name} = $value;
		}
	}
	close CONFIG;
	if (not $HoTTProxyAdminConfig{'AdminPort'}) {
		$HoTTProxyAdminConfig{'AdminPort'} = 8085;	# Default to 8085 if not specified
	}
}
=1=
THE END

<<< SINGLE PAGE >>>

UP TO ROOT | UP TO DIR

Google
 

E-mail Facebook Google Digg del.icio.us BlinkList Fark Furl Ma.gnolia Netscape NewsVine Reddit Slashdot Spurl StumbleUpon Technorati YahooMyWeb LiveJournal Blogmarks TwitThis Live News2.ru BobrDobr.ru Memori.ru MoeMesto.ru

0.0149229 wallclock secs ( 0.01 usr + 0.01 sys = 0.02 CPU)