George P. wrote:
> On Wed, 2 Jul 2003, Clinton wrote:
>
> > Hi
> > Using WinNt and ActiveState 5.6
> > I have a script reading data from a modem. For some reason it will not run
> > with a while loop. (I'm using a module which I don't fully understand, yet)
> > I can run the script from the command line, let it finish and rerun it
> > manually every thing works fine (with some impact on resources which I
> > can live with for the moment)
> > How do I make it rerun?
> > I tried wrapping the script in a
> > while(1){
> > use My::Module;
> > some script
> > exit;
> ^^^^
>
> Remove the 'exit' and it should run in(fine)tely. :)
>
> George P.
>
> > }
> > and then run it from the command line but it does not stay "live"
> > Gosh! I hope this makes sense it looks like my medication needs a boost!
> > Assistance appreciated
Hi Clinton.
George is right, but I have this feeling there may be something else amiss.
For a start, you do still need to terminate the process somehow. Also, 'use'
is a compile-time statement and, while it can be placed anywhere, it doesn't
make sense to put it anywhere other than at the top of the containing file.
Go for
use strict; # always
use warnings; # usually
use My::Module;
my $finished;
while (1) {
some_script();
exit if $finished;
}
sub some_script {
:
}
HTH,
Rob
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]