Dear all,

Me again...

I'm using a SOAP::Lite XMLRPC daemon to accept requests from an applet. So far it works very well, even when accepting multiple requests

However, it has developed an annoying habit recently of actually EXITING once it's finished all requests...which is weird...any help would be appreciated

thanks

Sam

#!/usr/bin/env perl use XMLRPC::Transport::HTTP; use XML::Xerces; use XML::Xerces::DOMParse; use Carp; use Fcntl ":flock"; my $daemon = XMLRPC::Transport::HTTP::Daemon -> new (LocalPort => 8081, Reuse => 1) -> dispatch_to('Monster') ; print "Contact to XMLRPC server at ", $daemon->url, "\n"; $daemon->handle; package Monster; sub go{ shift if UNIVERSAL::isa($_[0] => __PACKAGE__); my $CP = shift; my $filePath = "/usr/local/jakarta-tomcat-4.1.12/webapps/monster/j +obs/"; $|=1; my $parser = XML::Xerces::DOMParser->new(); $parser->setCreateEntityReferenceNodes(1); my $error_handler = XML::Xerces::PerlErrorHandler->new(); $parser->setErrorHandler($error_handler); my $in; eval {$in = XML::Xerces::MemBufInputSource->new($CP);}; error($@) if $@; eval {$parser->parse($in);}; error($@) if $@; my $doc = $parser->getDocument(); my $cps = $doc->getElementsByTagName("ChainPairs"); my $id = $cps->item(0)->getAttributes()->getNamedItem("index")->ge +tNodeValue(); my $filePath2 = "$filePath$id/"; mkdir $filePath2; my $fileNode = $doc->getElementsByTagName("File"); my $file = $fileNode->item(0)->getChildNodes->item(0)->getNodeValu +e(); $file = substr($file, 37); $pdb = substr($file, 0, -4); open (F, ">$filePath2$pdb.cp" ) or die "couldn't open file $pdb.cp +: $!"; flock(F, LOCK_EX); print F $CP; flock(F, LOCK_UN); close F; use POSIX ":sys_wait_h"; sub REAPER{ my $child; while (($child = waitpid(-1,&WNOHANG)) > 0) { $Kid_Status{$child} = $?; } $SIG{CHLD} = \&REAPER; # still loathe sysV } $SIG{CHLD} = \&REAPER; exec("/usr/local/bin/monster", "-i$id", "$filePath$file") unless fork( +); return 0; }

In reply to Daemon exits! by seaver

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.