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

Hi, Monks,

My question is about perl interactive shell and GUI. 
I wrote a perl script with TK. Once Gui up, I can do many things through click the buttons, or menus.

But now, the buttons and menus become more and more. So I want to create a shell for the script. I can type the cmd in the shell, and then do the same thing as click in GUI.

I can use this to create a shell simply:
while (defined ($_= $psh_term->readline($psh_cmd ? "pa_shell >> " : "pa_shell $num_cmd> "))) {

But, how can I create a shell like that with a MainWindow opened by:
my $mw = MainWindow->new;

So, once I type cmd in the shell, something can happen in the $mw as I click the button in it.

Thanks,

Replies are listed 'Best First'.
Re: perl interactive shell, and GUI
by kcott (Archbishop) on Oct 24, 2012 at 09:11 UTC

    G'day Zejian,

    Welcome to the monastery.

    I'm not entirely certain what you're asking for. Here's some possible solutions:

    • ptksh - "... a perl/Tk shell to enter perl commands interactively. When one starts ptksh a MainWindow is automaticly created, along with a ptksh command window.".
    • The widget demo provides a frontend with links to a variety of demonstration scripts. You could perhaps write something based on this using your scripts instead of the demo scripts.
    • Tk::NoteBook would allow you to have a single MainWindow with separate and independent functionality assigned to each tab.

    Please modify your post so that code appears in code tags (<code>...</code>) and normal text is in paragraph tags (<p>...</p>). This is explained in more detail in: How do I post a question effectively?

    -- Ken

Re: perl interactive shell, and GUI
by zentara (Cardinal) on Oct 24, 2012 at 11:31 UTC