2

I have been writing scripts and building them no problem. But what about when I want to accept user input?

I installed SublimeREPL and selected the perl package but I am not sure how to run my program using this console.

I haven't seen any documentation, I saw a video of someone running a python script and typing 'run' but that didn't seem to work for perl.

MattDMo
  • 100,794
  • 21
  • 241
  • 231
Marques
  • 27
  • 5

2 Answers2

0

Is SublimeREPL supposed to be Perl-able? I don't think so. Maybe you should try to run tour script directly from your favorite terminal emulator using perl myscript.pl.

smonff
  • 3,399
  • 3
  • 36
  • 46
  • SublimeREPL has a built in PERL setting/emulator but I don't see any documentation on the syntax or commands to run my scripts – Marques Mar 14 '13 at 15:36
  • Does a software with a feature is supposed to be missing the documentation about it ? You can't use it. If it's not documented, the feature don't exists. – smonff Mar 14 '13 at 17:31
0

The included Perl REPL (Packages/SublimeREPL/config/Perl/re.pl) is basically a very short perl program to eval() input one line at a time:

$| = 1;

    while(true) {
        print "perl>  ";
        $line=<>;
        $value=eval($line);
        $error=$@;
        if( $error ne "" ) { 
                print $error; 
            } else { 
                print "$value\n"; 
        }
    }

and, honestly, leaves a lot to be desired.

However, a quick search of CPAN revealed Devel::REPL, which you could try running in SublimeREPL. Create the following as Packages/User/SublimeREPL/config/Perl/Main.sublime-menu:

[
     {
        "id": "tools",
        "children":
        [{
            "caption": "SublimeREPL",
            "mnemonic": "r",
            "id": "SublimeREPL",
            "children":
            [
                {"caption": "Perl",
                "id": "Perl",

                 "children":[
                    {"command": "repl_open",
                     "caption": "Devel::REPL",
                     "id": "repl_perl",
                     "mnemonic": "p",
                     "args": {
                        "type": "subprocess",
                        "encoding": "utf8",
                        "cmd": ["/path/to/perl", "/path/to/Devel/REPL/re.pl"],
                        "cwd": "$file_path",
                        "syntax": "Packages/Perl/Perl.tmLanguage",
                        "external_id": "devel_repl"
                        }
                    }
                    ]
                }
            ]
            }]
        }
]

This will add a new Perl submenu to your Tools menu with a single Devel::REPL option. I don't have a chance to test it now, so good luck!

MattDMo
  • 100,794
  • 21
  • 241
  • 231