perl-testing

Implements Perl test suites using Test2::V0, prove, mocking, and coverage tooling.

Updated Mar 18, 2026
One-click install
npx skills add https://github.com/freedom909/real-estate-saas --skill perl-testing-freedom909
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: perl-testing
Source: https://github.com/freedom909/real-estate-saas/tree/main/.trae/skills/perl-testing
Command: npx skills add https://github.com/freedom909/real-estate-saas --skill perl-testing-freedom909

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Writing reliable Perl tests requires choosing the right framework, organizing test files, mocking dependencies, and measuring coverage, which is error-prone without established patterns. ## Core Features & Use Cases - TDD Workflow Guidance: Enforces the red-green-refactor cycle with concrete Test2::V0 and Test::More examples. - Test Infrastructure Patterns: Covers prove runner configuration, directory organization, fixtures, and shared test helpers. - Mocking and Coverage: Demonstrates Test::MockModule, Test::MockObject, and Devel::Cover reporting with CI thresholds. - Use Case: When building a new Perl module, use this Skill to scaffold a t/ directory, write subtests with deep comparison builders, mock external APIs, and verify 80%+ coverage before merging. ## Quick Start Write a Test2::V0 test suite for my Calculator module with subtests, exception checks, and a prove command to run it.

Frequently Asked Questions about perl-testing

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write Perl tests with Test2::V0?▼

Use Test2::V0 with is(), ok(), and subtest blocks, ending each file with done_testing. It supports deep comparison builders like hash, array, and bag for partial structure matching with better failure diagnostics than Test::More.

Test2::V0 vs Test::More for Perl testing?▼

Test2::V0 is the modern replacement offering richer assertions, better diagnostics, and extensible plugins, while remaining backward-compatible with Test::More tests. New projects should prefer Test2::V0; Test::More still ships with core Perl.

How do I run Perl tests with prove?▼

Run prove -lr t/ to execute all tests recursively with lib/ in @INC. Add -v for verbose output, -j8 for parallel execution, and --state=failed to rerun only previously failing tests.

How do I mock a Perl module in tests?▼

Use Test::MockModule to override methods on a package; the mock restores automatically when the object goes out of scope. For lightweight test doubles, Test::MockObject creates injectable objects with call verification via called_ok().

How do I measure Perl test coverage with Devel::Cover?▼

Run cover -test to execute the suite under coverage, then cover -report html for a browsable report. In CI, parse the text report total and fail the build when coverage drops below your threshold, such as 80 percent.

Why does prove fail to find my Perl modules?▼

prove fails with 'Can't locate module in @INC' when the -l flag is missing, because lib/ is not added to the include path. Always run prove -l or configure it in a .proverc file.