cant execute perl script - Strange error [closed] - perl

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.

Related

Have a problem with perl or fedora bash. my source is not recognized unless pre fixed with perl

I call the program myfoo.pl, my first line is #!/usr/bin/perl.
When run from command line myfoo.pl I get command not found.
again when run using perl myfoo.pl it runs and completes. Not all my perl programs have this problem some run just using (path)/source.pl I ran head -1 myfoo.pl and got a print of my first line. no indication of problems.
Looking at the limited information you gave, I would say you are probably missing permission executable on the file myfoo.pl. To which the solution is to do
chmod +x myfoo.pl
It could also be a path to binary problem, that the perl binary is not located in /usr/bin/perl. In which case you need to figure out where it is, with which perl or where perl.
I suppose it could also be that the file myfoo.pl is not in your current directory, which it needs to be. Because of path settings, you also may have to execute it with
$ ./myfoo.pl
Because . is part of your path variable.
It is impossible to say for sure, because you are not answering questions, however. So when you eventually get around to answering questions, we may have more answers.

prompt not appearing after running `perl` [duplicate]

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.

Embedded Chocolatey Installer Failing [closed]

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 2 years ago.
Improve this question
I keep getting the same error with my chocolatey package: Exit code was '-1'. I am not sure if it is something wrong with my chocolateyinstall.ps1 or the setup.exe I am using to make this embedded installer. The image below shows both the chocolateyinstall.ps1 and the cmd when trying to run choco install (packagename). Thanks.
Here is the code:
$packageArgs = #{
packageName = 'armrvds'
fileType = 'exe'
file = "$(Split-Path -parent $MyInvocation.Mycommand.Definition)\setup.exe"
validExitCodes = #(0)
softwareName = 'ARM RVDS 4.1*'
Install-ChocolateyInstallPackage #packageArgs
https://ibb.co/Mpnh0mq
Exit code was '-1' means that the exit code of the installer was -1, and not 0 or another acceptable exit code to be treated as successful. You will need to figure out why your setup.exe is failing. You may be able to find more information about why the installer failed if you look at C:\ProgramData\Chocolatey\logs\chocolatey.log as the error indicates.
One thing I notice is you are not setting the silent installation arguments as part of your arguments to Install-ChocolateyInstallPackage, which at a minimum may cause your package to require interactivity (you don't want this). You should find out what the silent installation arguments are to setup.exe.
In your case, it looks like RVDS uses a different program to install silently (page 7). Note that this is for 3.1, not 4.1, so you should either try to find up to date documentation, or see if setupcli still exists in 4.1 and start looking at the parameters it supports.

How command prompt works in all operating system [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
How command prompt communicate with hardware
if i give mkdir command it will create the directory
how this command works internally
can i create own commands.
You need to notice the difference between the OS and the shell. Shell is only a user-land program. When you type a command, the command is the name of another program(or some built-in command in shell itself), shell find the corresponding program and execute it.
The operations at this level is much higher than hardware, it's just user-land program call.
For mkdir, you type which mkdir then will find the path of this program named mkdir. If you want to create your own, just compile your own program and run it from shell.
First of all MKDIR doesn't change the Directory it Makes the new directory.
& These program internally runs like a Bash Script/Batch File, which are few predefined codes in the OS.
You can create your own command by creating Batch File, For which you need Notepad, Little Programing Skill & Output Parameters you Want To Achieve.
This Link Might help Creating CMD File

"sh -x" equivalent for Perl and Python scripts [duplicate]

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.