使用 Visual Studio Code 调试 Perl

2024-05-22

我今天刚开始使用 Perl 并安装了活动Perl https://en.wikipedia.org/wiki/ActivePerl5.24.1,一切都很顺利。我能够创建我的测试程序testPerl.pl与简单的print命令并运行它console.

Now I wanted to use Visual Studio Code to run my Perl script, and so I opened the project folder [testPerl.pl location] with Visual Studio Code and tried to debug the code. I have installed the Perl-Debug https://marketplace.visualstudio.com/items?itemName=mortenhenriksen.perl-debug extension in the editor and when I hit F5, Visual Studio Code asked me to Select Environment and I chose the Perl Debug option, which actually created the launch.json file for me with the below contents.

{
    "version": "0.0.2",
    "configurations": [
        {
            "type": "perl",
            "request": "launch",
            "exec": "perl",
            "name": "Perl-Debug",
            "root": "${workspaceRoot}/",
            "program": "${workspaceRoot}/${command.AskForProgramName}",
            "inc": [],
            "stopOnEntry": true
        }
    ]
}

I have kept default values as it, and when I hit F5 again, it asked me for a command with default value test.pl. It is because of ${command.AskForProgramName}, I assume. I entered my file name testPerl.pl in the command, but then nothing happens. It starts and ends without any print in console.

我该如何实际配置这个launch.json文件或者我需要其他方法来做到这一点吗?


我尝试使用较新版本的插件:Perl调试 https://marketplace.visualstudio.com/items?itemName=mortenhenriksen.perl-debug版本0.2.0。

这是开箱即用的。建议的配置如下所示:

{
    // 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": "${workspaceFolder}/${relativeFile}",
            "exec": "perl",
            "execArgs": [],
            "root": "${workspaceRoot}/",
            "inc": [],
            "args": [],
            "env": {},
            "stopOnEntry": true
        },
        {
            "type": "perl",
            "request": "launch",
            "name": "Perl-Debug remote",
            "program": "${workspaceFolder}/${relativeFile}",
            "root": "${workspaceRoot}/",
            "stopOnEntry": true,
            "port": 5000
        }
    ]
}

请注意,我在 Mac 上使用 Visual Studio Code 版本 1.24.0 进行了尝试。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

使用 Visual Studio Code 调试 Perl 的相关文章

  • Perl LWP::简单 HTTPS 错误

    我正在尝试获取网站的内容并打印 该代码按照我希望的方式在常规 HTTP 网站上运行 但它不适用于 HTTPS 我已经查找了此问题的修复程序 但它们在我的程序中不起作用 这是我目前拥有的代码 usr bin perl use strict u
  • 我怎样才能有一个像这样的动画SliverAppBar?

    我希望这些动画之间能够平滑 我尝试使用AnimatedSize AnimatedOpacity and AnimatedPositioned但几乎没有错误 我不知道如何使用这些SliverAppBar 在其他例子中我看到人们使用Layout
  • 多维哈希排序 - Perl [关闭]

    很难说出这里问的是什么 这个问题是含糊的 模糊的 不完整的 过于宽泛的或修辞性的 无法以目前的形式得到合理的回答 如需帮助澄清此问题以便重新打开 访问帮助中心 help reopen questions 我真的需要一些帮助来理解这个哈希并对
  • Perl 脚本(或任何东西)来合计 CSV 列

    我写了 在其他人的很多帮助下 awk command https stackoverflow com questions 4159224 excel and awk disagree about csv totals 4159404 415
  • Perl - 以相反的顺序逐行读取文件[重复]

    这个问题在这里已经有答案了 可能的重复 如何在 Perl 中从文件末尾读取行 https stackoverflow com questions 303053 how can i read lines from the end of fil
  • [“类型别名”只能在 .ts 文件中使用]

    我使用命令react native init 名称项目 然后打开vscode似乎有错误消息代码 图像 这就是你需要用 VS Code 做的事情 仔细观察 gif Steps to resolve error 1 Go to extensio
  • 找不到模块 dtrace-provider

    我有一个简单的nodejs应用程序抛出 Cannot find module build Release DTraceProviderBindings 我在网上查了一下 看起来很多人在 Windows 上使用 Restify 时都遇到了同样
  • 如何在正则表达式中匹配“/*”?

    stuff d learning perl tmp txt open STUFF stuff or die Cannot open stuff for read while
  • 为什么我不应该使用 UNIVERSAL::isa?

    根据这个 http perldoc perl org UNIVERSAL html http perldoc perl org UNIVERSAL html 我不应该使用 UNIVERSAL isa 而应该使用 obj gt isa 或 C
  • 在 VS 代码片段中,如何像变量一样重用转换以避免一次又一次地编写转换?

    例如 我想像片段中的变量一样重用此转换 而不是一次又一次地编写转换 TM FILENAME BASE 1 pascalcase example prefix example body TM FILENAME BASE 1 pascalcas
  • 在 VS Code 文件搜索中,我可以展开(或折叠)所有结果吗?

    在程序的 搜索 窗格中 按 Enter 键后 会列出所有文件 其中一些文件会展开以显示文件中的结果 而其他文件则会折叠 我首先想知道是什么决定了任何给定文件的扩展 其次我想知道如何一次性扩展所有文件 这个问题似乎最接近我的问题 但它是关于不
  • VS Code:如何在颜色主题中使用语义标记?

    我尝试更新我为 VS Code 制作的颜色主题 简单焦点 但我从未找到任何主题创建者关于如何使用新语义标记的指南 我已经设定 semanticHighlighting true在我的主题中 例如 我想要为类着色 并且类定义有特定的 text
  • 如何为不同的 Perl 应用程序安装专门的环境?

    就功能而言是否有与 Python 相同或接近的东西虚拟环境 http pypi python org pypi virtualenv what it does 但是对于 Perl 来说呢 我已经用 Python 进行了一些开发 并且将非系统
  • Perl Tk 模块有哪些缺点?

    与在 Perl 中创建 GUI 的其他解决方案相比 Tk 模块有哪些缺点 我最近浏览了 Perl 的各种 gui 模块 这是我的总结 免责声明 最终我发现现有模块都不能满足我的需求 所以我开始编写自己的 gui 工具包 Tk 工作起来很不错
  • 如何更改 Visual Studio Code“Powershell 集成控制台”?

    有谁知道如何安装 更新 PS 7 以供 VS Code Powershell 集成控制台使用 我可以在常规 powershell 终端上获取 PS 7 但 Powershell 集成控制台仍然是 PSVersion 5 1 我似乎不知道如何
  • 使用 SIGINT 默认处理程序时从 system() 返回值

    我遇到了一些奇怪的返回值system 当子进程从终端接收到 SIGINT 时 解释一下 从 Perl 脚本parent pl I used system 运行另一个 Perl 脚本作为子进程 但我还需要通过 shell 运行子进程 所以我使
  • Perl 非贪婪

    我遇到非贪婪正则表达式 regex 的问题 我已经看到有关于非贪婪正则表达式的问题 但它们没有回答我的问题 Problem 我正在尝试匹配 lol 锚点的 href Note 我知道这可以通过 Perl HTML 解析模块来完成 我的问题是
  • Bugzilla 中分离客户端的基本权限

    我正在尝试配置一个 Bugzilla 实例 这将允许我的客户登录并为其正在开发 维护的网站提交错误 例如 我创建了 2 个名为 TestProject TestProject2 的产品和一个名为 TestClient 的用户 我想要实现的是
  • 声明的包“”与预期的包不匹配

    我可以编译并运行我的代码 但 VSCode 中始终显示错误 早些时候有一个弹出窗口 我不记得是什么了 我点击了 全局应用 从那以后一直是这样 Output is there but so is the error The declared
  • 如何让 mod_perl 在更改时重新加载源文件?

    我正在开发一个带有 mod 的应用程序 perl 并在每次更改代码时重新启动服务器是一个巨大的阻力 我还是想用mod perl 用于开发 因为我计划将其用于实时服务器 我在文档中没有看到有关如何执行此操作的任何内容 想法 我认为 Apach

随机推荐