How do I get stack traces in Perl?
122036
Is there a way I can access (for printout) a list of sub + module to arbitrary depth of sub-calls  preceding a current position in a Perl script?  I need to make changes to some Perl modules (.pm's). The workflow is initiated from a web-page thru a cgi-script, passing input through several modules/objects ending in the module where I need to use the data. Somewhere along the line the data got changed and I need to find out where.
31025
How do I get Perl to read the contents of a given directory into an array?   can do it, but is there some method using 'scandir' or a similar term?
104102
I am trying to debug a hang during shutdown and I don't find where the messages that I see during shutdown are being stored.  They aren't in /var/log/syslog
36461
I have a PHP script that needs to determine if it's been executed via the command-line or via HTTP, primarily for output-formatting purposes. What's the canonical way of doing this? I had thought it was to inspect SERVER['argc'], but it turns out this is populated, even when using the 'Apache 2.0 Handler' server API.
95665
Why is it that find prints out a leading ./ to results if no paths are given?  $ find ./file1 ./file2 ./file3   What is the reason for not printing out this?  $ find file1 file2 file3
54085
I have explored almost    , to no avail.  Let me describe the problem in detail:  I run some unattended scripts and these can produce standard output and standard error lines, I want to capture them in their precise order as displayed by a terminal emulator and then add a prefix like "STDERR: " and "STDOUT: " to them.  I have tried using pipes and even epoll-based approach on them, to no avail. I think solution is in pty usage, although I am no master at that. I have also peeked into the source code of , but that has not been much productive.   Ideally I would use  instead of Bash to accomplish this, but I have not been able to. Seems like pipes automatically forbid keeping a correct lines order because of buffering.  Has somebody been able to do something similar? Or it is just impossible? I think that if a terminal emulator can do it, then it's not - maybe by creating a small C program handling the PTY(s) differently?  Ideally I would use asynchronous input to read these 2 streams (STDOUT and STDERR) and then re-print them second my needs, but order of input is crucial!  NOTE: I am aware of  but it does not work for me with Bash scripts and cannot be easily edited to add a prefix (since it basically wraps plenty of syscalls).  Update: added below two gists       (sub-second random delays can be added in the sample script I provided for a proof of consistent results)  Update: solution to this question would also solve , as @Gilles pointed out. However I have come to the conclusion that it's not possible to do what asked here and there. When using 2&gt;&amp;1 both streams are correctly merged at the pty/pipe level, but to use the streams separately and in correct order one should indeed use the approach of  that involves syscall hooking and can be seen as dirty in many ways.  I will be eager to update this question if somebody can disprove the above.
19726
function main() {    Hello(); }  function Hello() {   // How do you find out the caller function is 'main'? }   Is there a way to find out the call stack?
8699
How does one do this?  If I want to analyze how something is getting compiled, how would I get the emitted assembly code?
111970
I want to see if my process makes a lot of context switches. I also want to see how manpulating task groups affects the number of context switches.
34128
I'm looking for the equivalent of the Unix 'tail' command that will allow me to watch the output of a log file while it is being written to.
65632
In PHP you can do:  print_r($var) or vardump($var)   which prints "human-readible" information about variable.  Is there equivalent functions / helpers for those in Ruby / Rails ?
112023
In PHP, I can write:  $vname = 'phone'; $$vname = '555-1234'; print $phone;   ... And the script will output "555-1234".  Is there any equivalent in Perl?  Is there any way to constrain $phone to the scope of the local block, as if I'd written my $phone? Using my $$vname gives me "Can't declare scalar dereference in my at ..." errors.
51816
Is the behavior of .* to include . and .. defined in LSB or POSIX or some other specification?
100372
As a sysadmin I sometimes face situations, where a program behaves abnormally, while not creating errors at all or creating nonsense error-messages.  In the past - before java came in - there were two counter-measures:   If nothing else helps - RTFM ;-) If even 1. does not help - trace the system-calls and see what is happening   I usually use strace -f for this task with Linux (other OS have similar trace-tools). Now while this usually works well for any old-fashioned program, the trace gets very fuzzy when doing the same on a java-process. There are so many system-calls seemingly unrelated to any real action, that it is terrible to search through such a dump.  Are there better ways to do that (if the source-code is not available)?
58326
Is there an easy way to programmatically determine the number of lines within a text file?
13051
Is there any explanation/history behind the name of the command dmesg (which prints out some kernel messages)?
15669
I'm trying to debug a plugin which I didn't develop and I want to list all the registered actions. I've read this SO thread:    - StackOverflow   But it's specific to one hook and it's about filters, not actions.  Is there any variable like $wp_filter or something?