perl FileHandle Closure during after unlock


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting perl FileHandle Closure during after unlock
# 1  
Old 01-19-2012
perl FileHandle Closure during after unlock

Hi
we have one function which is used to append data the file in exclusive lock mode in aperl script.
This script is executed by multiple threads at the same time.
accessing the same file.this script runs throught the day.

sometimes the file2.txt size is getting reduced.
for eg from 10 M to 2 M.

Code:
 
fi(file1.txt);
f2(file2.txt);
sub f1
{
 my ($file) = @_;
my $data="haitetsing";
 open(FileHandler,">>$file") ;
--flock function is called
  print FileHandler $data;
  --unlock funciton is called
}

query:-
here we did not close the Filehandle ,is it making the script to remove the some contents of file.

Moderator's Comments:
Mod Comment Please use next time code tags for your code and data
# 2  
Old 01-19-2012
Is that the only code that writes to the file?

What does your flock code look like?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Need help in lock and unlock and after the changes

Requirement:First i need to unlock the directory which i had a script for it.If i select app1 it should unlock the directory and after chnages in the script once need to lock the directory with lock command The below highlighed variables in lock and unlock has to be changed according... (2 Replies)
Discussion started by: bhas85
2 Replies

2. Programming

Error:readline() on closed filehandle Perl

Hi, i have run the below perl code and i am getting an error Error:readline() on closed filehandle OR at run.pl line 31. CODE: =========================================== open OR,$ARGV; while (<OR>) { # find the batch date next if length $_ < 3; # BLANK LINE # last if $. > 120; #... (3 Replies)
Discussion started by: pspriyanka
3 Replies

3. Shell Programming and Scripting

how to use the filehandle stored in a variable without knowing its file association

how to use the filehandle stored in a variable without knowing its file association i.e. the filename code my $logFH = $connObj->get('logFH'); infoPrint("Variable is of type IO \n") if(UNIVERSAL::isa($logFH, 'IO')); infoPrint("$logFH\n"); output == INFO :: Variable is of type... (0 Replies)
Discussion started by: rrd1986
0 Replies

4. Shell Programming and Scripting

How to call a shell script from a perl module which uses Filehandle to login

Hi Guru's, Pardon me for the breach of rules..... I have very little knowledge about Shell Programming and Scripting hope you guys help me out of this troble I have very little time hence could not find the right way to direct my queries. coming to the problem I need to call a... (2 Replies)
Discussion started by: saikrishna_tung
2 Replies

5. Solaris

Solaris 10 Services - Audit and Closure

Hello We have recently been through an audit of our solaris servers. All our solaris servers are running version 10. We have been told to close down all the services and we have closed what we could by using svcadm disable We only wish to let ssh and the ftp service to run. Below is a... (3 Replies)
Discussion started by: sollyshah
3 Replies

6. HP-UX

not able to unlock user

Hi, not able to unlock user eventhough executed /usr/lbin/modprpw -k username Thanks in advance (2 Replies)
Discussion started by: bpsunadm
2 Replies

7. Shell Programming and Scripting

Perl: Opening a filehandle but not getting anything back from it

I have two perl functions defined, both run a set of shell commands on some somplied data and return hashs of the resulting parsed output from these shell commands. One works, one doesn't and I can't seem to see why. It's driving me insane :mad: The working one: sub getcellstatus { ... (8 Replies)
Discussion started by: Smiling Dragon
8 Replies

8. Shell Programming and Scripting

perl: howto print to screen & filehandle

Hello, I need to print messages both to screen and to file handle in perl , like tee does in unix . Any suggestions ? Thanks (2 Replies)
Discussion started by: Alalush
2 Replies

9. Programming

Change FileHandle

Hello, I currently have a system that is running and writing to a log file. Every month I run a rollLogs script that moves this file to a different location and creates a new file in the original location. The service that is writing to this log is running when i run this script and it still... (3 Replies)
Discussion started by: findandy
3 Replies

10. Solaris

How to unlock my editor?

When I want to use the editor ,whether vi or textedit,it prompts for entering a key. How can I disable this function?many thanks for offering solutions! (1 Reply)
Discussion started by: smartboy1461
1 Replies
Login or Register to Ask a Question