NAME

Developer::Dashboard::Handle - in-process proxy for the dashboard/d2 CLI

VERSION 4.29

PURPOSE

Gives Perl code a single-line way to reach the same runtime the dashboard/d2 command line resolves, instead of hand-building a Developer::Dashboard::PathRegistry, Developer::Dashboard::FileRegistry, and Developer::Dashboard::Config to answer one question such as a configured path alias.

WHY IT EXISTS

Filed after the project's owner asked directly (over the project's Telegram bridge) for a shorter Perl equivalent of dashboard path resolve NAME, then widened the request to cover any dashboard subcommand: "Anything I can run with d2 on bash [...] I am expecting the d2() subroutine can do the same." paths() answers the original, narrower ask in-process (no subprocess, since path aliases are cheap to resolve directly against the registry); run() and AUTOLOAD answer the widened one by shelling out to the real CLI for everything else, which is the only way to reach the full command surface without reimplementing it.

WHEN TO USE

From any Perl script or module in this project (or one with this distribution installed) that needs a configured path alias, or the output of any other dashboard subcommand, without forking a subprocess by hand and parsing its output itself.

HOW TO USE

use Developer::Dashboard;

my $foo = d2->paths->{foo};              # fast, in-process
my $out = d2->doctor;                    # shells to `dashboard doctor`
my $res = d2->run( 'tira.ticket.show', '--ref', 'DD-726' );
                                          # dotted subcommands: run() only

d2() (exported by Developer::Dashboard) memoizes one handle per working directory, so repeated calls from the same directory reuse the same registry rather than rebuilding it.

WHAT USES IT

Nothing in the shipped CLI itself - this is a convenience entrypoint for external Perl code (scripts, other distributions) that embeds this one. Developer::Dashboard::CLI::Paths and the rest of the CLI continue to build their own registries directly, unchanged by this module.

EXAMPLES

use Developer::Dashboard;

# A custom alias added with `dashboard path add reports /var/reports`:
my $dir = d2->paths->{reports};   # '/var/reports'

# Anything else the CLI can do, in-process:
my $version_text = d2->version;