In article <[EMAIL PROTECTED]>, Steve Johnson <[EMAIL PROTECTED]> wrote: > In message <[EMAIL PROTECTED]> > "Richard Torrens (RiscOS)" <[EMAIL PROTECTED]> wrote:
> > 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. > > > [snip] > I thought I'd just add my "two cents" worth (as I've written a few fairly > complex Perl scripts running on Unix!)... > Basically I always try to think in "Unix" mode for this sort of thing, > particularly as Perl was no doubt written with such "basic assumptions". Probably sensible - but as a lifetime RISCOS user who has only been into Unix for about a year, less than easy. This sort of advice helps. > Your original code just wouldn't work on Unix because the "system" > command executes in a child process and therefore has it's own > environment (and doesn't affect the parent's). I thought there must be a sensible explanation somewhere! > I would therefore use another method for my "OS code" to communicate > back to Perl. eg: > # cut down example - I put in more info in all messages in my "real" code > my $result = ""; > until ($result eq "Done") { > open INP, "{os-code} |" or die "Pipe failed"; > chomp ($result = <INP>); > close INP; > } ATM that's over my head... <Picks up Perl manual and starts reading>. > I know we don't have such process separation in RISC OS (for OS Envs > anyway), so it *shouldn't* be necessary, but you never know - one day the > underlying OS might be changed to Unix ! (... nahh! silly idea! 8-) -- ------------------------------------------------------------------------- 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 ----------------