ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> pdk
pdk
RE: PerlSvc questions
by David Hares other posts by this author
Feb 28 2002 4:45PM messages near this date
PerlSvc questions | Re: PerlSvc questions
To those kind enough to reply, it does not appear to be a scope problem.  The code looks som
ething like this:

$PerlSvc::Name ;
$PerlSvc::DisplayName ;

{	# start of code
   BEGIN {...}
   END {...}
   { ... # code to run if started via 'perl foo'
     &main::main();
     exit (0);
   }
}

sub PerlSvc::Install {
    $PerlSvc::Name = "foo";
    $PerlSvc::DisplayName = "foo";
}

sub PerlSvc::Startup {
    &main::main();
}

sub PerlSvc::Remove {}

sub PerlSvc::Help {}

sub main::main() { }

I know the following is true:

	The code at the beginning is executed when the .exe is run with
	the -install switch, and then the PerlSvc::Install subroutine is run.
      $PerlSvc::Name is set on exit from PerlSvc::Install.

	The code at the beginning is executed when the .exe is run with
	the -remove switch, and then the PerlSvc::Remove subroutine is run.
      $PerlSvc::Name is NOT set on entry to PerlSvc::Remove.  I actually don't
      expect it to be.

What I need to know is:

      Is code at the beginning executed when the service is started via 
	the 'start' selection in the services manager, and when is the PerlSvc::Startup
      subroutine run. 

      $PerlSvc::Name is NOT set on entry to PerlSvc::Startup.  I expect
      it to be, since the guys who program C++ around here (and disdain perl) say
      context is preserved between a service install and start. Is context preserved?

      If it's not preserved, is there any way to pass information from Install to
	Startup?

      Is there any approved way to check in the code at the beginning it's being run
      as a service?  My kludge is to check if PerlSvc::ContinueRun() is defined.

I'd like hear from the developers, and/or programmers with code that proves their
answers.

Thanks




-----Original Message-----
From: pdk-admin@[...].com
[mailto:pdk-admin@[...].com]On Behalf Of David Hares
Sent: Wednesday, February 27, 2002 5:00 PM
To: Pdk
Subject: PerlSvc questions


In using PerlSvc
	-In routine PerlSvc::Install I set $PerlSvc::Name = "FOO"
	-I turn foo.pl into foo.exe with -v -r (successfully)
	-I install FOO.  W2k-> services sees FOO installed but not started.
	-I start FOO.  PerlSvc::Startup thinks $PerlSvc::Name = ""

This is behavior I did not expect - What's going on?

-----------

David Hares 
Director, Network Engineering

Copernica Networks				Phone:	734.827.3620
650 KMS Place					FAX:    	734.827.3690
Ann Arbor, MI 48108				Email:	dhares@[...].net

_______________________________________________
PDK mailing list
PDK@[...].com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
_______________________________________________
PDK mailing list
PDK@[...].com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Thread:
David Hares
David Hares
Jan Dubois
David Hares
Jan Dubois

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved