richterger / Perl-LanguageServer

Language Server for Perl
Other
219 stars 53 forks source link

Add stdin redirection #166

Closed wielandp closed 1 year ago

wielandp commented 1 year ago

Redirect stdin if in args ..., "<", "filename", ...

wielandp commented 1 year ago

My testing:

Input

wp@DESKTOP-5OCF6FQ:~/src/pls$ cat stdin.txt ; echo
arg=value&cid=1&preview=Здравейте

Program

wp@DESKTOP-5OCF6FQ:~/src/pls$ cat test_stdin.pl 
use strict;
use warnings;

use CGI;
use JSON;
use utf8;
use open ':std', ':encoding(UTF-8)';

my $q = CGI->new;

print "cid: ".$q->param('cid')."\n";
print "preview: ".$q->param('preview')."\n";

launch.json

       {
            "type": "perl",
            "request": "launch",
            "name": "Perl-Debug",
            "program": "${workspaceFolder}/${relativeFile}",
            "stopOnEntry": true,
            "reloadModules": true,
            "env": {
                "REQUEST_METHOD": "POST",
                "CONTENT_TYPE": "application/x-www-form-urlencoded",
                "CONTENT_LENGTH": 34
            }
            "args": [ "<", "/home/wp/src/pls/stdin.txt" ]
        }

Debug console

cid: 1
preview: Здравейте
wielandp commented 1 year ago

files changed looks good. Only the comments are confusing