8/26/03 14:01:05, Alan Winston - SSRL Central Computing <[EMAIL PROTECTED]> wrote:
> >> I just can't figure this out: how do I overwrite an exisitng file >> without creating a new version? I.e., if x.;1 exists I want perl >> to use that and replace the contents. But when I try that >> I get: > >> $ perl -e "open(X,"">x.;1"") || die; printf X ""blabla""; >> Died at -e line 1. >> %RMS-E-FEX, file already exists, not superseded > > >> I couldn't find anything in perldoc perlvms or the web, >> please help. > >This whole idea makes me nervous. You seem to be trying to mimic Unix >filesystem behavior, Actually, yes, I do while porting a Unix script (Vipul's Razor). >and I really appreciate RMS versioning. So do I. >RMS versioning >would let multiple instances of your program run at the same time without >getting their hands crossed. Not an issue. The script has locking mechanisms in place. > >Are you sure that only one instance of your program will run at a time? Are >you sure that the contents of this file will have no value past the end of that >run of the program? Absolutely. The script wants to remember what it did in the last run. No need to remember what happened in the run before that one. And the one before... >(If so, why not have a cleanup routine that unlinks the >file when the program exits?) Maintenance headache. > >Enough angst. My best answer: Don't be so `aengstlich'. Maybe I know what I am doing... > >I don't know if there's a special incantation that will make this happen; >I know (from experience, and because it's what I usually want) that >">> x" will append to an existing file or create a new one if it doesn't exist. > >But you could probably ">> x" and then do whatever the standard perl operation >for truncate/erase/rewind is, and go from there. Well, than rather set file/version=1. I mean, in something like Fortran, that whole thing is a nobrainer. VMS can do this. But how with perl? But thanks anyway, Michael
