Re: Until loop

[email protected] ("Richard Torrens (RiscOS)") Mon, 01 Apr 2002 16:26:49 +0100
Newsgroups perl.riscos
Message-ID <[email protected]>
In article <[email protected]>,
   Nicholas Clark <[email protected]> wrote:
> On Mon, Apr 01, 2002 at 09:47:49AM +0100, Richard Torrens (RiscOS) wrote:
> > an anyone tell me why the following gets stuck?
> > 
> > until ($ENV{'BlackHole$BinDir'} eq "") {
> >   system ('Unset BlackHole$BinDir');
> > }
> > 
> > It gets stuck in a loop as if the test is only tested once.

> From memory, I think that's pretty close to what actually happens. I
> think that perl is actually caching things as they get read in %ENV. [I
> seem to remember I just re-used most of the existing VMS code that
> handles this sort of thing when porting]

> Try this

>   delete $ENV{'BlackHole$BinDir'};

> in place of the loop. I think it should work (not in a position to test
> it right now) as I think it will punch out to the real RISC OS
> environment and delete it there (with no error if it never was there in
> the first place)

> Nicholas Clark

Yes. Unfortunately I'm not really trying to merely unset a SysVar here.
I'm first feeding several * commands via system ()
   WO_RemoveTask BlackHole2
   Unset BlackHole$BinDir
   Unset BlackHole$UsedToday

then when that lot has happened another system () feeds
   Filer_Run ADFS::HD5.$.DataApps.!BlakHole2

Now this may take a long time to complete, as during loading BlackHole
expires out-dated directories, which takes an indeterminate time.

I am really trying to test when this deletion has finished as during
deletions BlackHole is single tasking and the network won't then
respond work. So after this has terminated I want to feed a signal to
the loop to release it. Setting an Env variable seemed sensible. But not
if the until {} loop won't read it.

-- 
-------------------------------------------------------------------------
Richard Torrens
4QD manufacture speed controllers for battery electric motors.
www sites http://www.4QD.co.uk http://www.4QDtec.com http://www.4QD.org
All email addresses are copyright.
Resale or use on any lists is expressly forbidden
---------- We use a RISC PC 32 bit RISC computer  ----------------