Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Hi everyone,
I'm not new to Perl but it's been a few years since I've last touched it I'm embarrassed to say.
I wrote this script a long while ago and it works daily. I never had an issue with it. It logs into one of my dev environments, makes a small update, and that's it. I have it set up as a chron job once a day. I want to configure this to do hourly updates so I want to just keep the script open instead and have it rerun every hour.
To do this, I wrapped everything in a while loop and threw a wait timer at the end of it. It works on the first run but the second time it runs automatically it breaks.
What might be causing this behavior? Why can't I just loop over it?
# all of my variables $instance, $user, $pass, $sid are defined above +this code. $| = 1; my $cnt = 0; while (1) { $cnt++; $instance = $instance . '/sys_script_list.do?SOAP'; use SOAP::Lite; sub SOAP::Transport::HTTP::Client::get_basic_credentials { return $user => $pass; } my $soap = SOAP::Lite -> proxy($instance); my $method = SOAP::Data->name('update') ->attr({xmlns => $instance}); my @params = ( SOAP::Data->name(sys_id => '657567'); push(@params, SOAP::Data->name(active => $active) ); my $result = $soap->call($method => @params); print '...UPDATED!' . "\n\n"; sleep(60); # wait an hour }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Looping with SOAP::Lite fails
by hippo (Archbishop) on Jun 09, 2016 at 15:28 UTC | |
|
Re: Looping with SOAP::Lite fails
by toolic (Bishop) on Jun 09, 2016 at 15:28 UTC |