我今天刚刚开始学习Perl,并安装了ActivePerl 5.24.1版本,一切都很顺利。我能够创建我的测试程序testPerl.pl
并通过console
运行简单的print
命令。
现在我想使用Visual Studio Code来运行我的Perl脚本,于是我用Visual Studio Code打开了项目文件夹[testPerl.pl位置],尝试调试代码。我在编辑器中安装了Perl-Debug
扩展程序。当我按下F5键时,Visual Studio Code要求我选择环境,我选择了Perl Debug选项,这实际上为我创建了launch.json
文件,其内容如下。
{
"version": "0.0.2",
"configurations": [
{
"type": "perl",
"request": "launch",
"exec": "perl",
"name": "Perl-Debug",
"root": "${workspaceRoot}/",
"program": "${workspaceRoot}/${command.AskForProgramName}",
"inc": [],
"stopOnEntry": true
}
]
}
我将默认值保留不变,当我再次按下F5时,它要求我输入一个带有默认值test.pl
的命令。 我想这是因为${command.AskForProgramName}
。 我在命令中输入了我的文件名testPerl.pl
,但是没有任何print
在控制台中出现。
我应该如何配置这个launch.json
文件,或者是否还有其他方法可以做到这一点?
launch.json
文件。根据其自动生成的文件,它与我们在命令行中执行的内容非常相似。 - Guruprasad J Rao