Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Reading a file live!

by Laurent_R (Canon)
on Mar 07, 2014 at 07:48 UTC ( [id://1077341]=note: print w/replies, xml ) Need Help??


in reply to Reading a file live!

In principle, it should not be necessarily blocking your main script, but this depends on many things, like what is your OS, how your secundary script is writing into the file, whether it closes the file when it is done, whether your secundary script is permanent or temporary, whether you are waiting for any specific output in the file, too many things that we don'y know.

I also wonder whether this is the best way of doing things. If you want to read the output of the secundary script in your main script, why do you need a secundary script at all? I am not saying it is a bad idea, I don't know enough, I am just questionning whether it is a good idea. Please tell us more about what you are trying to achieve.

Replies are listed 'Best First'.
Re^2: Reading a file live!
by negativ_m (Novice) on Mar 07, 2014 at 08:01 UTC

    I will try to explain better.

    #main script

    ...

    ...  #i am doing something

    system ("perl eck.pl $var > file.txt &"); #here i call my other script and i redirect the output into the file.txt. My eck.pl script will run some time but in my master script i need to use the newly added lines (always) from the txt file

    I need to read that file always ...i can do that but the problem is that is blocking my main script and i can;t use the new lines in my master script. In a way i am trying to read that file "live" get the lines and use them inside my master script.

    Hope you understand what i am trying to say.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1077341]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (5)
As of 2024-04-24 08:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found