NAME

Developer::Dashboard::PageDocument - common page model for Developer Dashboard

SYNOPSIS

my $page = Developer::Dashboard::PageDocument->from_instruction($text);
print $page->canonical_instruction;

DESCRIPTION

This module represents the common internal page model used by saved pages, transient encoded pages, and provider-generated pages.

METHODS

new, from_hash, from_json, from_instruction, merge_state, with_mode, as_hash, canonical_json, canonical_instruction, instruction_text, render_html

Construct, mutate, serialize, and render page documents.

PURPOSE

This module parses and normalizes dashboard bookmark instruction documents. It understands the separator-based bookmark format, extracts fields such as TITLE, BOOKMARK, STASH, HTML, and CODE* blocks, and preserves the raw instruction when callers need source-stable editing behavior.

WHY IT EXISTS

It exists because bookmark parsing is a core format contract. The editor, renderer, source view, seeded pages, and saved page store all need the same understanding of how a bookmark document is shaped.

WHEN TO USE

Use this file when changing bookmark syntax, source preservation, directive parsing, or any workflow that reads or writes the text instruction format behind saved pages.

HOW TO USE

Create or load a page document through the parsing helpers, then pass the normalized structure into the page runtime, page store, or web routes. Keep bookmark syntax rules in this module instead of scattering regex parsing around the codebase.

WHAT USES IT

It is used by page storage and rendering, by skill bookmark routing, by init/seed flows, and by tests that guard the bookmark document grammar.

EXAMPLES

Example 1:

perl -Ilib -MDeveloper::Dashboard::PageDocument -e 1

Do a direct compile-and-load check against the module from a source checkout.

Example 2:

prove -lv t/07-core-units.t t/21-refactor-coverage.t

Run the focused regression tests that most directly exercise this module's behavior.

Example 3:

HARNESS_PERL_SWITCHES=-MDevel::Cover prove -lr t

Recheck the module under the repository coverage gate rather than relying on a load-only probe.

Example 4:

prove -lr t

Put any module-level change back through the entire repository suite before release.