vscode配制perl环境

VScode是一个非常酷炫好用的编辑器,具有非常多的语言扩展包,我们可以通过安装这些扩展,来让它成为带有语法高亮的编辑器,当然,我们也可以对其进行配置,使其成为一个IDE。

以Perl为例:

软件准备
VScode : https://code.visualstudio.com/ 安装就按着进程一路next

Perl: 如果是Linux或者OSX等,系统自带有Perl解释器

如果是Windows,可以下载 Active Perl : https://www.activestate.com/activeperl 安装同VScode

检查Perl是否安装成功
在命令提示符中输入 Perl -v 查看Perl版本号及相关信息(我用的是Perlv5.26.1)

配置VScode
打开VScode ,在Extensions 中输入 Perl

根据需要下载所想要的扩展(我用的是Perl 和 Perl Debug)

创建项目,配置环境
1.创建项目

新建一个文件test.pl

2.配置Perl 编译环境

点击左侧Debug,选择 add configurations,弹出launch.json文件,修改配置如下:

{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [

{
"type": "perl",
"request": "launch",
"name": "Perl-Debug local",
"program": "${file}",
"exec": "perl",
"execArgs": [],
"root": "${workspaceRoot}/",
"internalConsoleOptions": "openOnSessionStart",
"windows": {
"args": []
},
"inc": [],
"args": [],
"env": {},
"stopOnEntry": true
},
{
"type": "perl",
"request": "launch",
"name": "Perl-Debug remote",
"program": "${workspaceFolder}/${relativeFile}",
"root": "${workspaceRoot}/",
"stopOnEntry": true,
"port": 5000
}
]
}
具体各个设置及其可选的值的意义可以将鼠标光标移至对应的位置进行查看。这里不再作介绍。

3.显示变量

完成以上,Vscode上已经可以运行Perl程序了,但是调试的时候,左侧的视窗无法显示变量。

这是因为我们还需要在Perl中安装一个模块PadWalker

如果是Windows 系统可以使用命令

c:> cpan PadWalker
如果之前安装好了Active Perl,也可以直接使用ppm命令

c:> ppm install PadWalker
如果是OSX系统,可以使用cpanm

具体命令参考:不同系统安装PadWalker的方法

4.重新打开VScode,调试程序


————————————————
版权声明:本文为CSDN博主「chenzhenglinjx」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/chenzhenglinjx/java/article/details/82723340

猜你喜欢

转载自www.cnblogs.com/triple-y/p/12822202.html