Re: RISCOS "free" system call
[email protected] (Phillip Marsden) Fri, 17 Jan 2003 14:24:10 +0000
| Newsgroups | perl.riscos |
|---|---|
| Message-ID | <[email protected]> |
At 20:14 17/01/2003 +1100, Iain 'Spoon' Truskett wrote: >* Phillip Marsden ([email protected]) [17 Jan 2003 20:09]: > > Apologies if this has been covered before, but I am a new subscriber, > > and have not yet got all the FAQ etc. > > > I wish to get the amount of free space on a floppy for a copy program > > which is working from a web page. Not having used Perl modules, I > > decided to use the RISC OS "free" command via the system function. > >Without delving into the Acorn specific modules: > >my $free = `free`; # note the backticks. > >This puts the output of the free command into the variable $free. > >Perhaps check out perlintro on perldoc.com or pick up a copy of >"Learning Perl"? Thanks for the speedy response. Yes, if I had been programming in Unix shell, then this would have been done long ago. :o) The two people I asked before (and who referred me to this list) suggested the back-quotes method. I tried it, but it failed, and I tried other methods which partially worked. However, with yet another person stating it should work, I was determined to investigate to the full. The solution was to use the 'free' command properly. I had assumed that I could give 'free' the full disk specification, but 'free' pre-pends the given parameter with 'ADFS::'. 'Free' had then failed because it did not understand "ADFS::ADFS::0". 'Free' did not send the error message back to my Perl variable - it sent it elsewhere, so I can only assume that RISC OS has the equivalent of stderr. With nothing being placed in the Perl variable, I thought that there was a problem with back-quotes. (I also learned that 'free' does not handle IDEFS on my hard drive. IDEFS must have its own version of 'free'). Thanks for the push to find the real reason behind my earlier failures. -- Regards, Phillip Marsden. [email protected]