Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: FILEHANDLE not visible outside subroutine

by choroba (Chancellor)
on Jul 26, 2013 at 16:11 UTC ( #1046552=note: print w/ replies, xml ) Need Help??


in reply to FILEHANDLE not visible outside subroutine

You should always check the return value of open:

open PS, "$psout |" or die $!;

Update: Also, it seems you are running the sub in a thread. Why do you think a filehandle would be shared?

لսႽ ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ


Comment on Re: FILEHANDLE not visible outside subroutine
Download Code
Replies are listed 'Best First'.
Re^2: FILEHANDLE not visible outside subroutine
by ravi6289 (Initiate) on Jul 29, 2013 at 02:34 UTC
    Hello choroba ,, I'm sure the open statement returns just fine ,. Although , I was not aware filehandles could not be shared in threads (newbie :/) , thank you so much for pointing that out . I have modified the code to avoid the filehandle statement , and used a shared variable to store the command output , it works great !! .. Thanks again ... :)

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (8)
As of 2016-02-08 23:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How many photographs, souvenirs, artworks, trophies or other decorative objects are displayed in your home?





    Results (291 votes), past polls