| | |
How do i run perl on windows 98
Please support our Perl advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
•
•
Originally Posted by 001
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
•
•
Join Date: Jun 2005
Posts: 16
Reputation:
Solved Threads: 0
You can try this bit of code to get the output and errors into a scrollable Tk::Text window:
Both Tk and IPC modules come with Activestate's perl install. The runme subroutine is mostly straight out of the Perl Cookbook Ch16. It reads the STDOUT and STDERR of the program and inserts each line into the appropriate Tk::Text window.
*.ppm's are packages to be used with Activestate's ppm utility (Programmers Package Manager) This is how modules are installed under windows. Strikes me as very similar to a Debian binary dpkg. =)
Kordaff
Perl Syntax (Toggle Plain Text)
#!d:\perl\bin\perl.exe -w use strict; use Tk; use IPC::Open3; my $filename="perl myfile.pl"; # change me for a different file my $mw=Tk::MainWindow->new(); # makes a new Tk window my $button=$mw->Button(-text => "Run $filename", -command => \&runme )->pack(); # this is the run button my $text=$mw->Scrolled(qw/Text -height 20 -scrollbars e/)->pack(); # stdout goes into this window my $texterr=$mw->Scrolled(qw/Text -height 10 -scrollbars e/)->pack(); # stderr goes into this one MainLoop; # Tk's mainloop, all event processing takes place here # if we don't reach MainLoop then the entire Tk window will be # unresponsive. sub runme { # this subroutine is called when the button is pressed my $pid = open3 (*PROG_IN, *PROG_OUT, *PROG_ERR, $filename) or die "Boom: $!\n"; # ok Boom is not best error msg. close (PROG_IN); # PROG_IN is for writing to programs that require input # see Ch16 for info on blocking and deadlock... foreach (<PROG_OUT>) { $text->insert('end',$_); $mw->update;} # each line is inserted into the widget, and update is called to # refresh it - i was having probs not seeing anything in text # windows. foreach (<PROG_ERR>) { $texterr->insert('end',$_); $mw->update;} }
Both Tk and IPC modules come with Activestate's perl install. The runme subroutine is mostly straight out of the Perl Cookbook Ch16. It reads the STDOUT and STDERR of the program and inserts each line into the appropriate Tk::Text window.
*.ppm's are packages to be used with Activestate's ppm utility (Programmers Package Manager) This is how modules are installed under windows. Strikes me as very similar to a Debian binary dpkg. =)
Kordaff
•
•
Join Date: Jun 2005
Posts: 10
Reputation:
Solved Threads: 0
Well if you really want to make the output stay on the screen. why not try using \r instead of \n.
On Tk, you can also use that open(STDERR,">>logfile");
and also use this line when executing your script.
Well , hope that works
On Tk, you can also use that open(STDERR,">>logfile");
and also use this line when executing your script.
Perl Syntax (Toggle Plain Text)
c:\>perl -W myscript.pl>>logfile2.log
•
•
Join Date: Oct 2006
Posts: 2
Reputation:
Solved Threads: 0
[quote=001;120203]Hello,
I am new to perl, and am using perl on windows 98, i have tried writting a program, but the problem i experiencing is how to run the program.
1 i am using active perl 5 which came with an installer
2.i use note pad for the program and saved with the extension .pl
What do i do to run this program. Please help.
Hi,
please save your program in notepad with extension .pl, But
where have you saved your perl package? say suppose in c dive
In the pgm written in notepad the first line should be as follows:
c:\>perl
Now save the pgm with .pl extension, go to command prompt type
perl filename.pl
this will surely work if any doubts mail me up re_raju@yahoo.co.in
I am new to perl, and am using perl on windows 98, i have tried writting a program, but the problem i experiencing is how to run the program.
1 i am using active perl 5 which came with an installer
2.i use note pad for the program and saved with the extension .pl
What do i do to run this program. Please help.
Hi,
please save your program in notepad with extension .pl, But
where have you saved your perl package? say suppose in c dive
In the pgm written in notepad the first line should be as follows:
c:\>perl
Now save the pgm with .pl extension, go to command prompt type
perl filename.pl
this will surely work if any doubts mail me up re_raju@yahoo.co.in
with windows 98, open a DOS window (MS-DOS prompt) and cd\ if necessary to get out of the windows directory.
Then type in:
c:\perl\bin\perl.exe name_of_script.pl
or if perl is in the command path:
perl name_of_script.pl
and press the enter key. The script will run and the output will remain on the screen. If it goes beyond one page of output you might be better writing the output to a file.
Then type in:
c:\perl\bin\perl.exe name_of_script.pl
or if perl is in the command path:
perl name_of_script.pl
and press the enter key. The script will run and the output will remain on the screen. If it goes beyond one page of output you might be better writing the output to a file.
Last edited by KevinADC; Oct 26th, 2006 at 4:25 pm.
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
EDIT: Infact, if you installed ActivePerl properly, it should have appended itself to path automatically.
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

EDIT: Infact, if you installed ActivePerl properly, it should have appended itself to path automatically.
Last edited by MattEvans; Oct 26th, 2006 at 6:10 pm.
Plato forgot the nullahedron..
![]() |
Other Threads in the Perl Forum
- Previous Thread: stop thread
- Next Thread: calling one perl program from within another
| Thread Tools | Search this Thread |






