You could post the code, if it's a program with the code. One thing that I like to do is use a dos prompt and try to run the file.... you MIGHT have to load the perl Executable and pass the file as a parameter, something like:
c:\perl\bin\perl.exe myfile.pl
I have it running on my XP box, and I can just double click it, or type the name of the .pl file, as if it were an exe, com or bat. However, the first line of the perl file should be the path to your perl.exe... so:
#!c:\perl\bin\perl.exe
It might be different on your system, I'm not sure, but if none of those solutions work, post your code, and we'll check it out.
Comatose
Taboo Programmer
2,910 posts since Dec 2004
Reputation Points: 361
Solved Threads: 215
Well, You could click on start, go to run, type in cmd, and then use the dos interface to run the perl program. You put the #!c:\perl\bin\perl.exe as the very first line in your perl file. I might be confused, but it sounds like you are writing a perl module, and not an actual perl script, because most perl modules end in .pm, or I'm guessing too .ppm. However, if you run the script from the command line, you will see any output that it spits out at you.
Comatose
Taboo Programmer
2,910 posts since Dec 2004
Reputation Points: 361
Solved Threads: 215
This Introductions section is for members to introduce themselves, not for technical questions to be asked and answered. As we have a forum section specifically for Perl I'll move the topic to it.
Catweazle
Grandad
4,335 posts since Mar 2004
Reputation Points: 229
Solved Threads: 149
Thanx Catweazle, I completely missed that one! :-|
001:
By using the dos prompt, the information that gets display stays on the screen. That's the whole point behind using the dos prompt. The information displayed will stay on the screen. In windows, as soon as you run your perl file, and it finishes, it closes the spawned dos-window that runs the perl file. If you are not very proficient at using DOS, another solution that can be used for testing purposes only is to add a:
$tmpvar = <STDIN>;
Before the program terminates. However, this requires you to hit enter, before the program will quit (if you put it before an exit or die), but it's easy to forget about it being in there... and it isn't really a good method of debugging. The best solution, is to run perl from the command line, passing your program as the parameter.
Comatose
Taboo Programmer
2,910 posts since Dec 2004
Reputation Points: 361
Solved Threads: 215
Well, An Alternative Method is to use a filename for all your output, so, for example, in one program that I made, I needed all the Error Messages To Go To A Log File, So I stuck This at the top of my program:
open(STDERR, ">>log");
Then any error message that I needed to read, would be in the same folder as my script, in a file called "log". I think you can do the same for STDOUT, and have all output belonging to the screen redirected to a file also. Let me know how it turns out.
Comatose
Taboo Programmer
2,910 posts since Dec 2004
Reputation Points: 361
Solved Threads: 215
Thanks Comatose,
It worked , but I still experience problems with the output when there are errors in the program. It justs spits out the output and its difficult to read. What do i do.
001
You could show us what you mean by pasting the difficult to read output between CODE tags here.
Rashakil Fol
Super Senior Demiposter
2,658 posts since Jun 2005
Reputation Points: 1,135
Solved Threads: 177
then that means that there are no errors being output (which is a good thing). If you can actually paste the output here, it would help a lot.
Comatose
Taboo Programmer
2,910 posts since Dec 2004
Reputation Points: 361
Solved Threads: 215
make sure you have an open command prompt window rather than typing the command into the Start > Run box. to open a command prompt window that wont disapear on completion, type cmd in the Start > Run box.
if you want to use the syntax c:\myperlscripts\perl myscript.pl, rather than c:\ActivePerl\bin\perl c:\myperlscripts\myscript.pl you need to add the path to the perl interprettor to the PATH environment variable. You can do this from the command prompt, but whatever you do, don't try it, it'll more than likely overwrite PATH with just the path to perl, and PATH generally contains alot of important paths. In XP, you can set environment variables from the My Computer > Properties popup dialog... I don't know if that's the case in Win98... Try My Computer (desktop) Right click > properties > advanced tab > environment variables button. Look for a system variable called PATH (case is irrelevant) and append the path to the perl interprettor to that list (semicolon delimited). My Perl path is C:\ActivePerl\bin.. and my whole PATH string looks like this:
c:\PHP\;c:\ActivePerl\bin;C:\Program Files\ActiveState Komodo 3.5\;C:\Program Files\Borland\Delphi7\Bin;C:\Program Files\Borland\Delphi7\Projects\Bpl\;c:\JavaProfiler\lib;C:\WinAVR\bin;C:\WinAVR\utils\bin;C:\Program Files\Alias\Maya7.0\bin;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Program Files\Intel\Wireless\Bin\;C:\Program Files\Microsoft SQL Server\80\Tools\Binn\;
Hey, I have two PATH strings, one for system and one for Matt... These paths screw up sometimes (they did more on my other PC)... But in general they should be concatenated when a program requests a named variable... So it doesn't matter if it's a user var or a system var.
c:\JavaProfiler\lib;C:\Program Files\Microsoft Visual Studio\Common\Tools\WinNT;C:\Program Files\Microsoft Visual Studio\Common\MSDev98\Bin;C:\Program Files\Microsoft Visual Studio\Common\Tools;C:\Program Files\Microsoft Visual Studio\VC98\bin;
Now you all know what I've got on my PC :P
EDIT: Infact, if you installed ActivePerl properly, it should have appended itself to path automatically.
MattEvans
Veteran Poster
1,386 posts since Jul 2006
Reputation Points: 522
Solved Threads: 64
ah... i had to type it all out before i remembered that... -_-
MattEvans
Veteran Poster
1,386 posts since Jul 2006
Reputation Points: 522
Solved Threads: 64