How do i run perl on windows 98

Please support our Perl advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Jun 2005
Posts: 2,052
Reputation: Rashakil Fol is just really nice Rashakil Fol is just really nice Rashakil Fol is just really nice Rashakil Fol is just really nice 
Solved Threads: 139
Team Colleague
Rashakil Fol's Avatar
Rashakil Fol Rashakil Fol is offline Offline
Super Senior Demiposter

Re: How do i run perl on windows 98

 
0
  #11
Jul 4th, 2005
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
You could show us what you mean by pasting the difficult to read output between CODE tags here.
Reply With Quote Quick reply to this message  
Join Date: Jun 2005
Posts: 16
Reputation: kordaff is an unknown quantity at this point 
Solved Threads: 0
kordaff kordaff is offline Offline
Newbie Poster

Re: How do i run perl on windows 98

 
0
  #12
Jul 4th, 2005
You can try this bit of code to get the output and errors into a scrollable Tk::Text window:

  1. #!d:\perl\bin\perl.exe -w
  2.  
  3. use strict;
  4. use Tk;
  5. use IPC::Open3;
  6.  
  7. my $filename="perl myfile.pl"; # change me for a different file
  8. my $mw=Tk::MainWindow->new(); # makes a new Tk window
  9.  
  10. my $button=$mw->Button(-text => "Run $filename",
  11. -command => \&runme )->pack(); # this is the run button
  12. my $text=$mw->Scrolled(qw/Text -height 20 -scrollbars e/)->pack(); # stdout goes into this window
  13. my $texterr=$mw->Scrolled(qw/Text -height 10 -scrollbars e/)->pack(); # stderr goes into this one
  14.  
  15. MainLoop;
  16. # Tk's mainloop, all event processing takes place here
  17. # if we don't reach MainLoop then the entire Tk window will be
  18. # unresponsive.
  19.  
  20. sub runme {
  21. # this subroutine is called when the button is pressed
  22. my $pid = open3 (*PROG_IN, *PROG_OUT, *PROG_ERR, $filename) or die "Boom: $!\n"; # ok Boom is not best error msg.
  23. close (PROG_IN);
  24. # PROG_IN is for writing to programs that require input
  25. # see Ch16 for info on blocking and deadlock...
  26. foreach (<PROG_OUT>)
  27. { $text->insert('end',$_); $mw->update;}
  28. # each line is inserted into the widget, and update is called to
  29. # refresh it - i was having probs not seeing anything in text
  30. # windows.
  31. foreach (<PROG_ERR>)
  32. { $texterr->insert('end',$_); $mw->update;}
  33. }

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
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 2,413
Reputation: Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough 
Solved Threads: 211
Team Colleague
Comatose's Avatar
Comatose Comatose is offline Offline
Taboo Programmer

Re: How do i run perl on windows 98

 
0
  #13
Jul 7th, 2005
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.
Reply With Quote Quick reply to this message  
Join Date: Jun 2005
Posts: 10
Reputation: JEt3L is an unknown quantity at this point 
Solved Threads: 0
JEt3L JEt3L is offline Offline
Newbie Poster

Re: How do i run perl on windows 98

 
0
  #14
Jul 10th, 2005
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.
  1. c:\>perl -W myscript.pl>>logfile2.log
Well , hope that works
Reply With Quote Quick reply to this message  
Join Date: Oct 2006
Posts: 2
Reputation: ramagiri is an unknown quantity at this point 
Solved Threads: 0
ramagiri ramagiri is offline Offline
Newbie Poster

Re: How do i run perl on windows 98

 
0
  #15
Oct 26th, 2006
[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
Reply With Quote Quick reply to this message  
Join Date: Mar 2006
Posts: 898
Reputation: KevinADC has a spectacular aura about KevinADC has a spectacular aura about 
Solved Threads: 67
KevinADC's Avatar
KevinADC KevinADC is offline Offline
Practically a Posting Shark

Re: How do i run perl on windows 98

 
0
  #16
Oct 26th, 2006
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.
Last edited by KevinADC; Oct 26th, 2006 at 4:25 pm.
Reply With Quote Quick reply to this message  
Join Date: Jul 2006
Posts: 1,091
Reputation: MattEvans is a jewel in the rough MattEvans is a jewel in the rough MattEvans is a jewel in the rough 
Solved Threads: 63
Moderator
Featured Poster
MattEvans's Avatar
MattEvans MattEvans is offline Offline
Veteran Poster

Re: How do i run perl on windows 98

 
0
  #17
Oct 26th, 2006
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.
Last edited by MattEvans; Oct 26th, 2006 at 6:10 pm.
Plato forgot the nullahedron..
Reply With Quote Quick reply to this message  
Join Date: Mar 2006
Posts: 898
Reputation: KevinADC has a spectacular aura about KevinADC has a spectacular aura about 
Solved Threads: 67
KevinADC's Avatar
KevinADC KevinADC is offline Offline
Practically a Posting Shark

Re: How do i run perl on windows 98

 
0
  #18
Oct 26th, 2006
EDIT: Infact, if you installed ActivePerl properly, it should have appended itself to path automatically.

Reply With Quote Quick reply to this message  
Join Date: Jul 2006
Posts: 1,091
Reputation: MattEvans is a jewel in the rough MattEvans is a jewel in the rough MattEvans is a jewel in the rough 
Solved Threads: 63
Moderator
Featured Poster
MattEvans's Avatar
MattEvans MattEvans is offline Offline
Veteran Poster

Re: How do i run perl on windows 98

 
0
  #19
Oct 26th, 2006
ah... i had to type it all out before i remembered that... -_-
Plato forgot the nullahedron..
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the Perl Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC