Welcome Guest ( Log In | Register)



 
Reply to this topicStart new topic
> Perl Interactive Mode
coolcat50
post Jan 18 2008, 10:59 PM
Post #1


Super Member
*********

Group: [HOSTED]
Posts: 232
Joined: 5-October 07
From: Random Places
Member No.: 51,171
Spam Patrol



I am kind of wondering why for some reason, Perl does not have an interactive mode in its parser like Pythong does in its. Also, Python comes pre-packaged with a GUI like parser and it is written in Python\Tk (I think that's what its called). I know that Perl has Perl\Tk, and I know it has an eval function. Why is there no interactive parser like that. I think I could come up with one. Anybody, wanna see if we can build a interactive module like the Python one?
Go to the top of the page
 
+Quote Post
slu
post Jan 19 2008, 08:04 AM
Post #2


Newbie [Level 2]
**

Group: Members
Posts: 27
Joined: 22-June 05
Member No.: 8,557



QUOTE(coolcat50 @ Jan 18 2008, 11:59 PM) *
I am kind of wondering why for some reason, Perl does not have an interactive mode in its parser like Pythong does in its. Also, Python comes pre-packaged with a GUI like parser and it is written in Python\Tk (I think that's what its called). I know that Perl has Perl\Tk, and I know it has an eval function. Why is there no interactive parser like that. I think I could come up with one. Anybody, wanna see if we can build a interactive module like the Python one?


Several options for interactive mode already exists.

Perl has a builtin debugger, that enables you to try code (and scripts) interactively. To get an debugging prompt start Perl like this:
CONSOLE
$ perl -d -e 1

Loading DB routines from perl5db.pl version 1.28
Editor support available.

Enter h or `h h' for help, or `man perldebug' for more help.

main:sad.gif-e:1): 1
DB<1> print "Hello\n";
Hello

DB<2> exit;
Debugged program terminated. Use q to quit or R to restart,
use o inhibit_exit to avoid stopping after program termination,
h q, h R or h o to get additional info.
DB<3> q
$

you can read the man pages "man perldebtut" and "man perldebug" or perldebug and perldebtut to learn more.

If the debugger isn't your thing, you can try the Perl Console, that seems to be very similar to the Python interactive mode: http://www.sukria.net/perlconsole.html

It looks like this:



Another option is The Perl Shell (psh), which is exactly that: a shell aiming at being a replacement of your favorite shell (i.e. bash). It's a bit different fromt the debugger and console, but you might like it: http://sourceforge.net/projects/psh/
Go to the top of the page
 
+Quote Post
coolcat50
post Jan 25 2008, 02:04 PM
Post #3


Super Member
*********

Group: [HOSTED]
Posts: 232
Joined: 5-October 07
From: Random Places
Member No.: 51,171
Spam Patrol



I actually came up with a script that does the job exactly. The only thing is that it is command prompt based. I do believe I have a Tk based one that I may post here. I would like to put a script like this onto SourceForge. Here is the command line script. I wrote this under Mac OS X at school.

CODE
#pmode.pl: A Perl program designed to act similar to then Python interactive mode
#    using the eval() function. It takes input from STDIN and evals it.

$i = 5;
while($i == 5) {
    print "Perl<< ";
    $code=<STDIN>;
    eval($code);
}
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

Topics Topics
  1. Perl Help(1)
  2. First Perl Programm(5)
  3. Second Perl Programm(0)
  4. Perl Programms(0)
  5. Perl Programming(0)
  6. Using Mysql With Perl(1)
  7. Perl V.s. Php(5)
  8. Easy Authenication With Cgi/perl(0)
  9. Perl Progamming/scripting(3)
  10. Perl/cgi Help!(3)
  11. Perl Interview Questions(1)
  12. Compiling Perl / Python?(3)
  13. Xmlhttprequest And Perl(2)
  14. Matching Accents In Perl Regular Expresions(1)
  15. Call C Code From Perl(1)
  1. Few Perl Snippets For Misc Things(2)
  2. What Is Perl ? For A Layman Like Me !(7)
  3. Where Do I Install Perl Scripts?(6)
  4. Perl As A Way To Program Desktop Applications(8)


 



- Lo-Fi Version Time is now: 16th May 2008 - 08:00 PM