Maplat

 view release on metacpan or  search on metacpan

Examples/helloworld_windowsservice/maplat_svc.pl  view on Meta::CPAN

# To build this script into a PerlSvc, select:
#   Tools | Build Standalone Perl Application...
#
# Note: This functionality is only available if the Perl Dev Kit is
# installed. See: http://www.ActiveState.com/Products/Perl_Dev_Kit/
#

package PerlSvc;
use strict;
use warnings;

BEGIN {
    if(!defined($ENV{TZ})) {
        $ENV{TZ} = "CET";
    }
}

use XML::Simple;
use Time::HiRes qw(sleep usleep);
use MaplatSVCWin;
use Getopt::Long;



my $isCompiled = 0;
if(defined($PerlSvc::VERSION)) {
	$isCompiled = 1;
}

use Maplat::Helpers::Logo;
our $APPNAME = "Maplat SVC";
our $VERSION = "2009-12-09";
MaplatLogo($APPNAME, $VERSION);

my $configfile;
our %Config;

sub Interactive {
	print "INTERACTIVE - running Startup()\n";
	Startup();
}

# the startup routine is called when the service starts
sub Startup {
	
	Getopt::Long::GetOptions(
        'config=s'     => \$configfile,
    );
	
	my $config = XMLin($configfile,
                    ForceArray => ['module', 'run'],);

    if(!$configfile) {
        $configfile='C\src\maplat\configs\rbssvc.xml';
		print "Using default config file '$configfile'\n";
	} else {
		print "Using config file '$configfile'\n";
	}
	
	my $svcserver = new MaplatSVCWin(RunningAsService(),
								  $config->{basedir},
								  $config->{memhserver},
								  $config->{memhnamespace},
								  $APPNAME,
								  $VERSION,
								  $isCompiled,
								  );

	
	my @modlist = @{$config->{module}};
	$svcserver->startconfig();

	# Configure run-once scripts
	if(defined($config->{startup}->{run})) {



( run in 2.715 seconds using v1.01-cache-2.11-cpan-5837b0d9d2c )