Threads is perfect for this. You could create 1 Soap::Lite object and keep using it over and over. This is untested, but is simple to understand what is happening. I would use Glib or AnyEvent to make a timer to wake the thread, but this while loop shows the simplicity.
#!/usr/bin/perl use warnings; use strict; use threads; use threads::shared; my $tgo:shared = 0;; my $tdie:shared = 0; my $thread = threads->new(\&check_it); # setup a timer or use a while loop here # probably need to Control-C out of this loop # unless you add some keyboard checking for a q # or whatever while(1){ sleep 10; $tgo = 1; print "starting check\n"; } $tdie = 1; $thread->join; print "done press any key to exit\n"; <>; ################################################### sub check_it { use SOAP::Lite; $|++; # this will be persistent in the thread my $soap_client = SOAP::Lite->uri('myuri') ->proxy('http://serviceendpoint', timeout => 30, keep_alive => 1); while(1){ if($tdie == 1){ return }; if ( $tgo == 1 ){ print "soap start\n"; $soap_client->call('SomeMethod',$paramter); print "soap done\n"; $tgo = 0; #turn off self before returning to sleep }else { sleep 1 } } } __END__

I'm not really a human, but I play one on earth.
Old Perl Programmer Haiku ................... flash japh

In reply to Re: SOAP::Lite How to use persistent connection across fork process by zentara
in thread SOAP::Lite How to use persistent connection across fork process by Anonymous Monk

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.