Win32::Daemon relies upon a dll, Daemon.dll which if the installation on your development machine is correct, you should find installed in
X:/perl/site/lib/auto/win32/daemon/
or somewhere similar. I've never used 5.005, so I am unsure whether the blib paths were different back then.
Adding the contents of Win32::Daemon.pm to the top of your script would work and be trivial, but the seems little point it adding its 20k to your script to save "polluting the install", when you would need to place a 72/76 kb binary in the appropriate place in the perl directory tree anyway. In any case, the general method of using Win32::Daemon appears to be to have two scripts: The first is the deamon itself (which used Win32::Daemon) and the second is a short script to install the first (which also needs Win32::Daemon). So, all you would be doing is wasting 20k of space. Whilst it wouldn't be too hard to combine the install and service scripts into one, the next time you want to create another service script your back to square one.
The bottom line is that you are going to have to put Deamon.dll somewhere. You might get away will placing it in on a server somewhere and loading it across the network to each machine, though your going to have to play some nasty tricks with Dynaloader.pm to make that work. You might even encode the dll using mime64 or similar and tack it onto the end of your script and reconstitute it at run-time, but the chances of making this work at all, never mind reliably are pretty darn slim.
Examine what is said, not who speaks.
1) When a distinguished but elderly scientist states that something is possible, he is almost certainly right. When he states that something is impossible, he is very probably wrong.
2) The only way of discovering the limits of the possible is to venture a little way past them into the impossible
3) Any sufficiently advanced technology is indistinguishable from magic.
Arthur C. Clarke.
| [reply] [d/l] |
thanks to everyone for the responses. love you all :)
------------------------
<if the answer you get is not what you want> <ask a different question>
| [reply] |
What's wrong with requiring that all target machines have Win32::Daemon compiled?
Also, it very likely is that Win32::Daemon has a bunch of XS, meaning you'd have to compile it on the target machine, anyways?
------ We are the carpenters and bricklayers of the Information Age. Don't go borrowing trouble. For programmers, this means Worry only about what you need to implement. Please remember that I'm crufty and crochety. All opinions are purely mine and all code is untested, unless otherwise specified. | [reply] |
thank you very much. Unfortunatelly Win32::Daemon seems a little more complicated in loading than CGI, and fails with: Can't locate loadable object for module Win32::Daemon in @INC (@INC contains: D:/Perl/lib D:/Perl/site/lib .) at D:/Perl
/lib/DynaLoader.pm line 108
btw all that my code does is update password for some services.
Chris
| [reply] |
| [reply] |
my $dir = Cwd::getcwd() . "/" . $0;
$dir =~ s#([/\\])[^/\\]+$#/lib#;
push(@INC,$dir);
require PrivateModule;
That way you are only affecting your own script and
you can use the standard module.
| [reply] [d/l] |
I'm not experienced enough with Perl to be sure I'd be answering your question thoroughly, and it deserves a thorough answer so I'll withhold for the moment and let those who can, do.
I will address what seems the obvious issue to me -- you are going to be running this Perl script on all those remote machines, so something is going to be copying it out there -- Can it not also copy the modules you need?
I don't understand why you think you are limited to one script's worth of code.
| [reply] |
Cannot pollute the remote machine perl environment as it's part of a large system. it is totally out of the question for me to do so.
Chris
| [reply] |