Skip to content

Perl module roots

This configuration is available in version 0.1.32 and later.

For a workspace whose Perl modules live outside the root or lib, set explicit roots in .attocode/config.toml:

[perl]
module_roots = ["lib", "dist/Carp/lib"]

An explicit list replaces the defaults. Include "." if modules directly under the workspace root should resolve too. An empty list disables static Perl module lookup. Without this setting, the defaults are "." and "lib".

Roots must be workspace-relative directories. Separators and dot components are normalized, and duplicate roots are removed. Safe internal symlinks resolve to their physical workspace path. Absolute paths, parent traversal, ASCII control characters, outward symlinks and non-string entries are skipped. A safe root that does not exist cannot add any files. Missing, malformed or incorrectly typed outer configuration keeps the defaults. The loader accepts only a contained regular configuration file of at most 1,000,000 bytes.

Roots affect resolution over files already discovered by the index. They do not override exclusions. For example, to include just the dist/Carp source distribution under an otherwise excluded build directory, add this to the workspace's root .gitignore:

!dist/
dist/*
!dist/Carp/

If multiple configured roots contain the same module, resolution stays unresolved; list order does not select a winner. Definitions remain searchable in their own files. Perl .t test scripts participate when discovered.

Changes to effective roots are picked up on the next tool operation and after reopening the workspace, even when source files have not changed. Reordering roots or changing unrelated remote settings keeps the same dependency policy. Saving remote settings preserves existing TOML data, including these roots; comments and formatting may change.

In version 0.1.33 and later, remote saves use a flushed private temporary file and atomic replacement. Failed data writes or publication keep the previous valid bytes. The .attocode directory and config.toml entry must not be symlinks, including links to another location inside the project. Nonregular, unreadable, malformed, invalid UTF-8 or over-1,000,000-byte existing files are refused; repair them before saving. Successful saves set file mode 0600. Project-directory aliases are supported. Serialized output must also fit the 1,000,000-byte limit; an update that would exceed it is refused before publication, keeping the previous file intact.

This does not merge concurrent writers or guarantee persistence through power loss. An abrupt process kill can leave a private temporary file. Directory descriptors anchor writes if paths are changed concurrently; the returned path can still be redirected by an external filesystem edit.

This is conservative static resolution. The index does not execute Perl, evaluate use lib or BEGIN, or read runtime @INC and global module paths. Native syntax and literal call evidence do not prove a runtime binding.