← ClaudeAtlas

perl-modernlisted

Use when writing, reviewing, or securing Perl 5.32+ code. Covers modern idioms (signatures, postfix deref, Moo, class/field, try/catch), taint mode and injection-safe patterns, and Test2::V0 testing with prove and Devel::Cover.
Mixard/fable-pack · ★ 1 · AI & Automation · score 74
Install: claude install-skill Mixard/fable-pack
# Modern Perl ## Idioms ### Version-gated features | Feature | Since | Notes | |---|---|---| | `isa` infix operator | 5.32 | replaces `blessed($o) && $o->isa('X')` | | `use v5.36` baseline | 5.36 | enables strict, warnings, signatures, `say` | | `builtin 'true', 'false'` | 5.36 | experimental | | `for_list` (multi-var for) | 5.36 | experimental in 5.36, stable in 5.40 | | `class`/`field`/`method` (Corinna) | 5.38 | `use feature 'class'; no warnings 'experimental::class';` | | native `try`/`catch` | 5.40 | stable; earlier versions use Try::Tiny | ### Preamble and signatures `use v5.36` replaces the legacy boilerplate (`use strict; use warnings; use feature 'say', 'signatures'; no warnings 'experimental::signatures';`). ```perl use v5.36; sub connect_db($host, $port = 5432, $timeout = 30) { # defaults, arity-checked return DBI->connect("dbi:Pg:host=$host;port=$port", undef, undef, { RaiseError => 1, PrintError => 0 }); } sub log_message($level, @details) { # slurpy param say "[$level] " . join(' ', @details); } ``` ### Context and dereferencing ```perl my @items = (1, 2, 3, 4, 5); my @copy = @items; # list context: elements my $count = @items; # scalar context: 5 my @users = $data->{users}->@*; # postfix deref (readable in chains) my @roles = $data->{users}[0]{roles}->@*; my %first = $data->{users}[0]->%*; # Slices @subset{qw(host port)} = @{$config->{database}}{qw(host port)}; my @first_two = $config->{data