This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
How can I make Perl and Python print each line of the program being executed?
I'm looking for an equivalent of sh -x for Perl and Python.
(Excerpted from Programming Perl’s chapter on the debugger.)
If your .perldb file contains:
parse_options("NonStop=1 LineInfo=tperl.out AutoTrace");
then your program will run without human intervention, putting trace
information into the file tperl.out. (If you interrupt it, you’d better
reset LineInfo to /dev/tty if you expect to see anything.)
Install Devel::Trace and perl -d:Trace.
Related
This question already has answers here:
How can I start an interactive console for Perl?
(24 answers)
Closed 1 year ago.
I have asked a similar question elsewhere but it eventually evolved into a series of comments. So once again, what package should I install to see the following prompt > after running perl but now not raku (all under Cygwin)?
EDIT
-l doesn't work either.
EDIT 2
Perl -d -e1 doesn't work for me either (Answer in comments as this question is closed):
You didn't provide the name of a program, and you didn't provide a program via the -e or -E command line options, so it's reading the program from STDIN.
perl does have a builtin debugger that you access by passing -d, but you still need to provide a program. (You can provide a trivial one using -e1.)
See How can I start an interactive console for Perl? for alternatives.
This question already has answers here:
How to stop a PowerShell script on the first error?
(11 answers)
Closed 3 years ago.
I've been using Unix for about 20 years, but only started using Powershell recently. I have a ps1 script that does a number of tasks.
I know I could check each of them, and throw if they error, but it would be good for the entire script just to exit on any errors - like set -e does in bash.
How can I make a Powershell script exit immediately upon any error?
Using pwsh 6.2.1.
Having just found the answer to my own question:
ErrorActionPreference does this.
$ErrorActionPreference='Stop'
at the top of the ps1 file.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
I have written a perl script which running fine in my system but not working in some other system.
It is showing error "can't execute ...... at line 1".
everything is set up. I have tested in version 5.8.2 and working fine. But in 5.8.6 it is not working. While compile this code I got that Archive/Tar.pm is missing.
I have checked in my system perl lib folder there is no such Folder/module. Also I didnt get any result for perldoc -lm Archive::Tar in my system but still it is running fine.
Can you let me know what might be the possible problem ?
First line :: #! C:\system\Perl
This program is for windows
Try running dos2unix on your script. It probably has Carriage Returns in the first line.
dos2unix yourscript
You can check with
cat -vet yourscript
CR shows up as ^M.
Also, try running:
which perl
and make sure that your first line matches the answer.
Try running the script using:
perl yourscript
rather than
./yourscript
Are you sure the first line is terminated correctly for your OS (for example, Linux hates CR+LF line terminators... :-)
If Perl is saying that Archive::Tar is missing then it is probably right. Don't argue with it - just install the module.
This question already has answers here:
#ARGV is empty using ActivePerl in Windows 7
(4 answers)
Closed 9 months ago.
I'm running ActivePerl 5.8.8 build 822 on Win7 x64. We're working on a project that is about 60% C++, 15% perl, etc. The Perl is heavily used to link bits and pieces and various small utility applications together to create and pack our final data. So, for example, our VS2005 solution has post build events to create hard links to DLL's using a post build perl script which lives at some location on our development drive (it is part of PATH env var).
I found out quickly, that without explicitly putting "perl" to call the interpreter in-front of the postbuild.pl script call, it wouldn't accept command line arguments. I tested this further simply by going to the cmd window and doing the same with a "hello world" style perl script. No command line arguments were passed in when I say "bleh.pl arg1 arg2". But when I say "perl bleh.pl arg1 arg2" I get command line arguments.
When this failure occurs, perl reads zero command line arguments, and the #ARGV variable empty or null (whatever this crazy language does). So they're simply not passed in.
This is an issue because there are hundreds if not thousands of calls to perl scripts which I fear are not behaving correctly, and it is unreasonable to think I should have to prefix every .pl script invocation with perl explicitly, not to mention we're using version control and I don't want to commit all these garbage changes nor manage them in my stash.
PERL env var exists and points at the folder where the perl binary lives. As well as PATHEXT has .PL in it for perl scripts. Likewise, my PATH contains the folder entries to get to the scripts and to perl also.
Any help on how to figure this out would be immensely appreciated! Also, when I installed ActivePerl (I've done so many times now trying to figure this out). I allowed it to change my Path and associate file extensions in windows, which you would think would be the solution.
Thank you!
Your association is broken (incomplete). First, open a console and execute
assoc .pl
You'll get something like
.pl=SOMETHING
Then, execute
ftype SOMETHING
You should get something like
SOMETHING="C:\SOMEWHERE\bin\perl.exe" "%1" %*
but you'll get something like the following instead:
SOMETHING="C:\SOMEWHERE\bin\perl.exe" "%1"
To fix it, execute
ftype SOMETHING="C:\SOMEWHERE\bin\perl.exe" "%1" %*
This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
How can I fire and forget a process in Perl?
I'm looking for a way to invoke a new process from a Perl script, that will let a launched program and a Perl script, from which it's launched, proceed to work concurrently.
The program is SIPp, if it's important.
Thank you.
If you actually want separate processes, then another option is fork and exec.
if (fork) {
# In the parent program
# Continue as usual
...
} else {
# In the new child program
# Replace with another program
exec $some_other_program;
}
SIPp has "-bg" commandline parameter.
This parameter launches SIPp in background mode.
Use Proc::Background
In Windows system you may use "start" command.
For example:
start notepad
OR
start /d"C\Program Files\Sipp3.1" sipp.exe -sn uac