npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

node-perl-debugger

v0.0.4

Published

An interface to allow Node programs to debug Perl scripts

Downloads

21

Readme

node-perl-debugger

An interface to allow Node programs to debug Perl scripts.

This module uses the Perl debugger's remote capabilities to debug a Perl program.

Caveats

This has only been tested on perl 5.16.3 If the debugger changes the way data is printed between Perl versions, this module may not work correctly.

Usage

$ npm install

To run the tests:

$ grunt

To generate the API doc:

$ grunt doc

Starting a Debugger Host

An example of how to use the module is in the test/perl folder.

To start a host for the Perl debugger to connect to, use the DebuggerHost class. Once a host is listening a Perl process can be connected using the PERLDB_OPTS env variable eg:

$ pwd
~/node-perl-debugger/test/perl

$ PERLDB_OPTS=RemotePort=localhost:12345 perl -d test.pl

Using the commands interface

The DebuggerCommands class can be used to issue commands to the debugger. It uses an instance of DebuggerParser to understand output from the debugger.

Clients should wait for the ready event before issuing commands.

The commands utilise Javascript Promises to coordinate the sending, and receiving of data with the debugger. While clients can listen for events emitted after commands have been issued, in practise any event emitted will also be processed in order to settle a Promise returned from a command function.

For example, the break event is used to resolve the Promise returned from the continue() function since the Perl programming is continuing it's execution until a breakpoint is hit (assuming one has been set).

See the API docs, and the example test Perl program to see the commands in action.

Example

This example is used to debug the test Perl program in the test/perl program

"use strict";

var DebuggerHost = require("node-perl-debugger").DebuggerHost;

var debug = new DebuggerHost({
  log: process.stdout,
  port: 12345
});

debug.on("disconnection", function() {
  debug.close();
});

debug.on("close", function() {
  console.log("Finished");
});

debug.listen();

var commands = debug.commands();

commands.on("ready", function() {
  commands.break("Calculator.pm", 10)
      .then(function() {
        return commands.break("test.pl", 45);
      })
      .then(function() {
        return commands.continue();
      })
      .then(function() {
        return commands.stacktrace();
      })
      .then(log)
      .then(function() {
        return commands.continue();
      })
      .then(function() {
        return commands.variables();
      })
      .then(log)
      .then(function() {
        return commands.quit();
      })
      .catch(console.error);
});

function log(json) {
  console.log(JSON.stringify(json, null, 2));
}