Skip to content

Instantly share code, notes, and snippets.

@hakonhagland
Created October 9, 2023 19:08
Show Gist options
  • Save hakonhagland/15800c09d36ba8ee034ca1b962ad33e2 to your computer and use it in GitHub Desktop.
Save hakonhagland/15800c09d36ba8ee034ca1b962ad33e2 to your computer and use it in GitHub Desktop.
Debug perl in VS Code on Windows

Open Ubuntu 22.04 WSL terminal in Windows Console

  • Update and upgrade packages:
$ sudo apt-get update
$ sudo apt-get upgrade
  • Install build tools
sudo apt-get install make gcc g++ pkg-config libperl-dev
  • Install cpanm
$ sudo apt-get install cpanminus
  • Install Perl::LanguageServer
$ sudo /usr/bin/cpanm Perl::LanguageServer
  • Open VSCode from the WSL Ubuntu terminal (Important: do not open it from Powershell or Cmd) by executing
$ code .
  • Go to Extensions tab, and search for "perl language", see screenshot:

image

  • Create a test perl script, then click the "Debug" icon in the left panel:

image

  • Set a breakpoint at line 6, and click "Run and Debug":

image

  • You can now step through the program:

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment