Skip to content

Nihilus118/perl-debug-adapter

Repository files navigation

Perl Debug Adapter

This debug adapter invokes perl -d and handles communication with VS Code.

It should work out of the box on Linux, Windows and Mac using VS Code. It also works inside Microsofts Remote Extensions Remote-SSH, Remote-WSL and Remote-Containers.

Setup

VS Code

  • Install the Perl5 Debug Adapter extension in VS Code.
  • Perl needs to be installed and the path of the perl executable either needs to be available inside the $PATH environment variable or be provided via the launch.json configuration file.
  • The PadWalker module needs to be available in your environment.
  • OPTIONAL I recommend using this extension together with BSCANs Perl Navigator as it provides great language server features out of the box.

Other Editors and IDEs

As this extension implements the Debug Adapter Protocol it should be usable with other editors and IDEs aswell. Feel free to try it out and report any bugs that may occur.

Manual Install

Build dependencies:

Runtime dependencies:

  • Node.js
  • Perl, with the following modules:
  • a POSIX-compliant shell (sh), cat, chmod, find, rm,

Build

To build (on Linux), clone this repository and run the following in the root of the repository:

npm install
npm run compile

The adapter can then be invoked with

node -- out/debugAdapter.js

Install

To manually install this package, run the build steps above, then

prefix="/usr/local" # or wherever you want

npm install -g --install-links \
  --prefix "$prefix"
# Make sure that users can traverse to read the js being run
find "$prefix/lib/node_modules/perl-debug-adapter" \
  -type d -execdir chmod 755 '{}' +

# Replace the (broken) executable generated by npm with a wrapper script
rm "$prefix/bin/perl-debug-adapter"
cat <<EOF >"$prefix/bin/perl-debug-adapter"
#!/bin/sh
exec node -- "$prefix/lib/node_modules/perl-debug-adapter/out/debugAdapter.js" "$@"
EOF
chmod 755 "$prefix/bin/perl-debug-adapter"

then the adapter can be invoked with just

perl-debug-adapter

if $prefix/bin is in your PATH.