Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Perl shell with input and output terminal

by baxy77bax (Deacon)
on Nov 27, 2015 at 10:13 UTC ( [id://1148706]=perlquestion: print w/replies, xml ) Need Help??

baxy77bax has asked for the wisdom of the Perl Monks concerning the following question:

Hi

well my title si probably wrong since I don't quite know what the precise question is. What I am looking for is a perl shell with two screens so that I can write a command to be executed in one screen and once I run it, it executes in the other. To create a shell with Term modules is quite easy but to split the screen (withought using split and screen commands) is something I don't know how to do. So my question is: can anyone point me to the right place for me to learn more about about this problem.

Example:

my terminal: ___________________________________________________ $ # my shell where I | Hi! $ # can write my code | How to do ths? $ | $ print "Hi!\n"; | $ print "How to do ths?"| ________________________|___________________________
Am I making any sense?? thnx

Replies are listed 'Best First'.
Re: Perl shell with input and output terminal
by Corion (Patriarch) on Nov 27, 2015 at 10:19 UTC

    I would look at Curses. The cheap/no-frills alternative would be to use screen and just write your output to a file. In the "other" window, you could have tail -f /tmp/that.file running to show the output.

Re: Perl shell with input and output terminal
by Discipulus (Canon) on Nov 27, 2015 at 10:35 UTC
    it exists yet: is psh Anyway i dunno if it is a good idea but if you want to explore the matter, remember that eval lets your program to be very near to the compiler, everytime. So you can have something simple as (with error cheching too!!) in few keystroke:
    perl -ple "$_=eval||$@"

    L*
    There are no rules, there are no thumbs..
    Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.
      Ok, this is much much better than what I have :) But I really don't need so much functionalities. moreover, as I said, creating a shell is not so much of a problem. Bigger issue is to have a shell where you can write commands in the left side of your terminal and se a real-time output in the right side. I just thought there is some wrapper or screen emulator or something like that.

      Thank you :)

      Corion's solution is quite nice, but I worry about safety of such an approach. Open solutions an pipelines ar eusually safety hazards (This is my personal opinion!!!)

        Corion's solution is quite nice, but I worry about safety of such an approach. Open solutions an pipelines ar eusually safety hazards (This is my personal opinion!!!)

        Let's see if we can't sway your opinion. Please provide a specific example of a situation where one process writing to a file and another tailling it (just as in Corion's post) could lead to anything hazardous. Describe the specific hazard as you see it. Thanks.

Re: Perl shell with input and output terminal
by LanX (Saint) on Nov 27, 2015 at 16:30 UTC
Re: Perl shell with input and output terminal - modules of interest
by Discipulus (Canon) on Nov 30, 2015 at 11:28 UTC

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://1148706]
Approved by marto
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (4)
As of 2024-04-23 21:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found