Wagner, David --- Senior Programmer Analyst --- WGO wrote:
> Ed wrote:
>> I'm trying to do  a simple file rename and am starting to pull my
>> hair out. 
>> 
>>   # Open the infile for read, no append, no create, no clobber
>>   open RIGHTSLISTFILE, "<$rightslistfilename"
>>       || die ("admin_user_ex : Error: Can not open file:
>>   $rightslistfilename \n"); # Open the outfile for write, no append,
>>   create nonexisting open TMPFILE, ">$tmpfilename"
>>       || die ("admin_user_ex : Error: Can not open file:
>> $tmpfilename \n"); 
>> 
>> ...
>> read from rightslistfile and write to tmpfile.
>> ...
>>   close (RIGHTSLISTFILE);
>>   close (TMPFILE);
>> ...
>       Before renaming, must either rename the original file or delete
> because rename will not rename to existing filename. 
> 
>> $retval = rename $tmpfilename, $rightslistfilename;
>> print "retval: $retval<br>";
>> 
>> retval is 0 and the target file never gets updated.
>       0 indicates failure in this setup and non zero is success.
> so I would do something like:
> 
>  if ( ! rename $tmpfilename, $rightslistfilename ) {
>       print "Error in rename of file: " , $@ , "\n";
        it is not $@, but $!
Wags ;)

>       print "tmpfilename: " , tmpfilename, .......
>  }
> Wags ;)
>> 
>> Thanks in advance.
>> 
>> --
>> Ed
> 
> 
> 
> *******************************************************
> This message contains information that is confidential
> and proprietary to FedEx Freight or its affiliates.
> It is intended only for the recipient named and for
> the express purpose(s) described therein.
> Any other use is prohibited.
> *******************************************************


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to