0

I'm new to ActivePerl. However, I need to using it on my new Windows 8.1.

I try to download both 5.26.1.2601 and 5.24.3.2404 (x64) to installed.

But when I run with file.pl and file.bat, it would be suddenly closed in few second.

Then I need to test with different Windows OS. I saved these files to my daughter's computer that is Windows 7 32-bit and surprise that all works very well just clicking.

I already set PATH to C:\Perl64\bin and C:\Perl64\site\bin but it still not working.

So, I doubt why problem occured on my Windows 8.1 and how to solved its?

Thank

user2971638
  • 437
  • 1
  • 4
  • 10
  • NOTE: I already closed Anti-Virus while installation and running. – user2971638 Mar 16 '18 at 08:10
  • Windows 8 and Windows 10 (and their server equivalents), seem to suppress STDERR when run from the console. There may be a setting to change this. Errors used to appear in the console itself or in a dialog box that pops up. For starters, try running the command like this: perl file.pl > error.txt Then look at the error file. Also remember to call your perl scripts with "perl " It seems to affect how command-line arguments are parsed if you just call the script by itself. – TalkVideo Network Mar 16 '18 at 09:19
  • 1
    In the command prompt run: `cd /d %USERPROFILE%\Desktop` . Then run `perl myfile.pl` – wolfrevokcats Mar 16 '18 at 21:37
  • Done. But nothing change. It seems perl don’t know or forget with a code in myfile.pl. Doubt why my sister’s laptop working in first run without file changes. – user2971638 Mar 17 '18 at 03:49

2 Answers2

2

I suspect you are running them by double-clicking them. This runs the program and immediately exits (losing all output) as soon as the program is done. For toy programs that's practically immediately.

What happens when you run the programs from a Command Prompt (or PowerShell) window?

brian d foy
  • 121,466
  • 31
  • 192
  • 551
  • Yes, I running them by double-clicking. But as I try to running on my sister's laptop (Windows 7 32-bit), it works since first double-clicking! For a Command Prompt, when I type perl myfile.pl. It warning "Can't open perl script myfile.pl. No such file or directory." Note: I place myfile.pl on Desktop as same as place on my sister's laptop. It's very strange so much. – user2971638 Mar 16 '18 at 14:51
  • Did all suggestions but can't solved anyway. Really doubts with this error. – user2971638 Mar 16 '18 at 18:14
  • You need to run it by giving the path to the file or be in the same directory as the file. – brian d foy Mar 20 '18 at 03:15
0

I suggest brian d foy's response is on target, but there's more. The windows OS needs to be CAREFULLY APPENDED include the path to the perl interpreter in the system environment variable PLUS the computer might need a RE-BOOT, or the command window in use will need a PATH revision to update the path to include that same directory location for the perl interpreter. You stated that the path was set, but not clearly; was that in the command prompt window or via the system environment variable? I suggest updating the PATH environment variable in the system via the Windows control panel.

The call to run the perl script could be made from the directory containing the perl script, or the path to the script needs to precede the call, such as: c:\directory-a\dirctory-b\file.pl ---running file.pl from c:\users\mysuername isn't going to cut it, unless that just happens to be where the perl script lives.

A debugging suggestion, add the following statements to your perl script:

print "my script runs!";
sleep 4;

and see if anything shows on the screen. If you run from the command window rather than double-clicking the file in File Explorer, the window shouldn't disappear.

Geoff W.
  • 11
  • 4