Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: print statements in perl pakages seem to be masked from STDOUT

by 1nickt (Canon)
on Mar 07, 2018 at 16:27 UTC ( [id://1210458]=note: print w/replies, xml ) Need Help??


in reply to print statements in perl pakages seem to be masked from STDOUT

The main code is extremely stringy

What does that mean? I'm not familiar with "stringy" to describe code.

Suddenly they stopped.

What did you do before it suddenly stopped printing your debug statements? What was the effect of undoing the most recent thing you did?


The way forward always starts with a minimal test.
  • Comment on Re: print statements in perl pakages seem to be masked from STDOUT

Replies are listed 'Best First'.
Re^2: print statements in perl pakages seem to be masked from STDOUT
by holandes777 (Scribe) on Mar 07, 2018 at 17:00 UTC

    I wish I could tell you what happened. I added print statements in the package, I was seeing them in the output, I added a print statement, I stopped seeing any output from the package, I removed the recently addded print statement, I could no longer see any output from the package

    Years ago I remembered that I tried to print in a package and it did not work, I wrote it off to scope and moved on with debug objects. My question is: should I expect a print statement to provide output on STDOUT as it does when the print statement is in the main body of the .pl?

    If the answer is "no". can you point me at something that will help me output data from the package so I can see what is happening inside that code?

      My question is: should I expect a print statement to provide output on STDOUT as it does when the print statement is in the main body of the .pl?

      You should definitely see the print statements on STDOUT from a module, just like the script, unless the module is hijacking STDOUT somehow per Corion's post above.

      The answer is a conditional "yes" as described by Corion and stevieb. If you are suspicious that STDOUT has been overridden, you could always open your own filehandle and print your debug statements to a file. But if

      print {$self->{fileout}} "what I want to print\n";
      does not work, then you may not have opened your filehandle successfully, or it may not be stored in the variable you think it is. Did you check?


      The way forward always starts with a minimal test.
        Thank you, I will check that and report back.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (6)
As of 2024-04-23 15:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found