Skip to content

API Reference parrot.knowledge.wiki.languages.perl

github-actions[bot] edited this page Dec 2, 2026 · 4 revisions

parrot.knowledge.wiki.languages.perl

View source

Perl plugin for the wiki repo scanner.

Deep extractor for .pl/.pm/.t files (FEAT-432): an API outline (package/class/role containers, sub/method with their signature and doc, Moose/Moo has attributes, and Corinna field declarations) via tree-sitter when the optional ai-parrot[wiki-languages] extra is installed, or a bounded, line-anchored regex heuristic otherwise. Import extraction (use/require/use parent/use base) is regex-based in both modes; core-language pragmas (strict, warnings, feature, version literals like v5.38, ...) are filtered out since they never resolve to a repository file. Reference resolution follows Perl's standard convention: Module::Name resolves to lib/Module/Name.pm (or any other lib/-rooted directory in the repo tree); require "./lib.pl" style paths resolve relative to the importing file's directory.

Alias LanguageOutline

Re-exported from parrot.knowledge.wiki.languages.base.LanguageOutline.

Alias LanguageScanner

Re-exported from parrot.knowledge.wiki.languages.base.LanguageScanner.

Class PerlScanner

Deep extractor for .pl/.pm/.t files.

Attributes:

Attribute Type Description
name str
suffixes frozenset[str]
mode str Tier the NEXT file would be served by (predictive, FEAT-609). "ast-grep" when the structural seam is enabled and available, else "tree-sitter" when the optional grammar loads, else "heuristic".

Method PerlScanner.outline

Extract summary, API outline, and raw imports from Perl source.

outline(source: str, rel_path: str) -> LanguageOutline

Parameter Type Default Description
source str Raw Perl source text.
rel_path str POSIX-style path relative to the repository root (unused by this scanner — kept for interface parity).

Returns: LanguageOutline — The extracted :class:LanguageOutline. Any extraction failure degrades to an empty outline rather than raising.

Method PerlScanner.build_reference_index

Build a (file_set, lib_dirs) pair over the repo file list.

lib_dirs is the list of directories named lib that contain at least one .pm file, used as resolution roots for Module::Name specifiers.

build_reference_index(rel_paths: Iterable[str]) -> Any

Parameter Type Default Description
rel_paths Iterable[str] POSIX-style relative paths of every scanned file.

Returns: Any — Opaque (frozenset[str], list[str]) index.

Method PerlScanner.resolve_import

Resolve a Module::Name or require:-prefixed specifier.

resolve_import(spec: str, from_file: str, index: Any) -> str | None

Parameter Type Default Description
spec str Raw import specifier from :meth:outline — either a Module::Name (from use/require/use parent/use base) or a require:-prefixed relative path (from require "./lib.pl";).
from_file str POSIX-relative path of the importing file.
index Any The (file_set, lib_dirs) pair from :meth:build_reference_index.

Returns: str | None — The resolved rel path, or None when unresolved.

Alias astgrep

Re-exported from parrot.knowledge.wiki.languages.astgrep.

Attribute logger

Alias render_outline

Re-exported from parrot.knowledge.wiki.languages.render.render_outline.

Alias structural_enabled

Re-exported from parrot.knowledge.wiki.languages.render.structural_enabled.

Alias treesitter

Re-exported from parrot.knowledge.wiki.languages.treesitter.

Architecture

Clients

Bots & Agents

Memory

Knowledge

Tools & Toolkits

Flows

Experts

Skills

Stores & Loaders

MCP & A2A

Server & APIs

Integrations

Outputs & A2UI

Prompts

Security

Operations

Migration

SDD Tooling

LLM Wiki

Deployment

Decisions

API Reference

Clone this wiki locally