coolcat50 0 Report post Posted January 18, 2008 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? Share this post Link to post Share on other sites
slu 0 Report post Posted January 19, 2008 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:-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: https://sourceforge.net/projects/psh/ Share this post Link to post Share on other sites
coolcat50 0 Report post Posted January 25, 2008 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. #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);} Share this post Link to post Share on other sites