perl-patterns

Applies modern Perl 5.36+ idioms and conventions when writing, reviewing, or refactoring Perl code.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Legacy Perl codebases often rely on outdated boilerplate, unsafe constructs like two-arg open, and manual argument unpacking, making code hard to maintain and error-prone. This Skill guides the AI to write and refactor Perl using modern 5.36+ standards. ## Core Features & Use Cases - Modern Idioms: Enforces use v5.36, subroutine signatures, postfix dereferencing, named regex captures, and the isa operator. - OO & Error Handling: Provides Moo class and role patterns, Try::Tiny and native try/catch error handling, and safe file I/O with Path::Tiny and autodie. - Project Tooling: Covers standard module layout, cpanfile dependency management, perltidy/perlcritic configuration, and a legacy-to-modern quick reference table. - Use Case: When asked to refactor a legacy Perl script that uses my ($x) = @_ and two-arg open, the AI rewrites it with signatures, three-arg open, and Moo classes. ## Quick Start Ask the AI to review or rewrite your Perl script using modern Perl 5.36 patterns and best practices.

Frequently Asked Questions about perl-patterns

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

FAQPage Schema
How do I modernize legacy Perl code to Perl 5.36?▼

Replace the strict/warnings boilerplate with a single `use v5.36` pragma, convert manual `@_` unpacking to subroutine signatures, and swap circumfix dereferencing for postfix syntax like `$ref->@*`. The Skill provides a legacy-to-modern quick reference table for common replacements.

Should I use Moo or Moose for Perl object-oriented code?▼

Prefer Moo for lightweight, modern OO with type constraints via Types::Standard. Use Moose only when you need its full metaprotocol. On Perl 5.38+, the experimental native `class` keyword (Corinna) is another option.

What is the safest way to open files in Perl?▼

Use three-argument open with a lexical filehandle and an encoding layer, combined with the autodie pragma to eliminate manual `or die` checks. Avoid two-arg open entirely, since embedding user data in the mode string creates shell injection risks.

How do I handle exceptions in modern Perl?▼

Use Try::Tiny for reliable try/catch semantics on Perl 5.36, or the native try/catch syntax available experimentally in Perl 5.40+. Plain eval/die works but requires careful checking of `$@` immediately after the eval block.

How do I manage Perl module dependencies for a project?▼

Declare dependencies in a cpanfile with version constraints, then install them locally using Carton. Run scripts with `carton exec` so the project uses its own isolated dependency set rather than system-wide modules.