XML-Twig - Re: Explorer crashing while writing into XML

Posted on Thu Aug 31 16:10:43 2006 by aloknath251 in response to 2860 (See the whole thread of 6)
Re: Explorer crashing while writing into XML
Hi, I have added the following lines of code for locking the file. I see a new problem after the following code is executed, the XML file is completely blank. If I remove the file locking code the XML is atleast populated. However the xplorer still used to crash -both with file locking and without file locking. Can any one point out what is wrong in this code ? Or how to debug ? I am using IIS web server.
# Save user name and email # Inserting the submitted info my $node = XML::Twig::Elt->new( 'User', {'name' => $usr}, XML::Twig::Elt->new( 'email' => $email )) ; $node->paste( last_child => $twig->root ) ; #use lock to write into the file sysopen( FH, $registerFile, O_RDWR ) or die "can't open $registerFile: $!"; flock( FH, LOCK_EX) or die "can't lock filename: $!"; truncate(FH, 0) or die "can't truncate filename: $!"; $twig->print_to_file( $registerFile ) ; close(FH)
Direct Responses: 2876 | Write a response