From 3721034df44b8a17ca717802b66379a29a883060 Mon Sep 17 00:00:00 2001 From: Graham Ollis Date: Tue, 23 Sep 2025 09:36:19 -0600 Subject: [PATCH 1/2] take advantage of newer perls --- .github/workflows/linux.yml | 6 ------ Changes | 1 + lib/Test2/Tools/MemoryCycle.pm | 19 +++++++++---------- t/test2_tools_memorycycle.t | 1 + 4 files changed, 11 insertions(+), 16 deletions(-) diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 772764a..9ffcdae 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -29,12 +29,6 @@ jobs: - "5.24" - "5.22" - "5.20" - - "5.18" - - "5.16" - - "5.14" - - "5.12" - - "5.10" - - "5.8" env: CIP_TAG: ${{ matrix.cip_tag }} diff --git a/Changes b/Changes index e6cbb11..76c2cdc 100644 --- a/Changes +++ b/Changes @@ -1,6 +1,7 @@ Revision history for {{$dist->name}} {{$NEXT}} + - Drop support of Perl prior to 5.20 0.01 2022-09-29 06:33:02 -0600 - initial version diff --git a/lib/Test2/Tools/MemoryCycle.pm b/lib/Test2/Tools/MemoryCycle.pm index bcb6a73..af44967 100644 --- a/lib/Test2/Tools/MemoryCycle.pm +++ b/lib/Test2/Tools/MemoryCycle.pm @@ -2,7 +2,9 @@ package Test2::Tools::MemoryCycle; use strict; use warnings; -use 5.008004; +use 5.020; +use feature qw( state ); +use experimental qw( signatures ); use Devel::Cycle qw( find_cycle ); use Test2::API qw( context ); use Exporter qw( import ); @@ -54,9 +56,7 @@ Checks that C<$reference> doesn't have any circular memory references. our @EXPORT = qw( memory_cycle_ok ); # Adapted from Test::Memory::Cycle for Test2::API -sub memory_cycle_ok { - my $ref = shift; - my $msg = shift; +sub memory_cycle_ok ($ref, $msg=undef) { $msg ||= 'no memory cycle'; @@ -97,20 +97,19 @@ sub memory_cycle_ok { return $ok; } # memory_cycle_ok -my %shortnames; -my $new_shortname = "A"; +sub _ref_shortname ($ref) { + state $shortnames = {}; + state $new_shortname = "A"; -sub _ref_shortname { - my $ref = shift; my $refstr = "$ref"; - my $refdisp = $shortnames{ $refstr }; + my $refdisp = $shortnames->{ $refstr }; if ( !$refdisp ) { my $sigil = ref($ref) . " "; $sigil = '%' if $sigil eq "HASH "; $sigil = '@' if $sigil eq "ARRAY "; $sigil = '$' if $sigil eq "REF "; $sigil = '&' if $sigil eq "CODE "; - $refdisp = $shortnames{ $refstr } = $sigil . $new_shortname++; + $refdisp = $shortnames->{ $refstr } = $sigil . $new_shortname++; } return $refdisp; diff --git a/t/test2_tools_memorycycle.t b/t/test2_tools_memorycycle.t index 9aec465..a5e72cd 100644 --- a/t/test2_tools_memorycycle.t +++ b/t/test2_tools_memorycycle.t @@ -1,3 +1,4 @@ +use 5.020; use Test2::V0 -no_srand => 1; use Test2::Tools::MemoryCycle; From 63c9c05554494bcaa9476bb552651ff6c044660b Mon Sep 17 00:00:00 2001 From: Graham Ollis Date: Tue, 23 Sep 2025 09:37:49 -0600 Subject: [PATCH 2/2] bump gha versions --- .github/workflows/linux.yml | 4 ++-- .github/workflows/static.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 9ffcdae..e458af9 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -34,7 +34,7 @@ jobs: CIP_TAG: ${{ matrix.cip_tag }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Bootstrap CIP run: | @@ -47,7 +47,7 @@ jobs: cip cache-key - name: Cache CPAN modules - uses: actions/cache@v2 + uses: actions/cache@v4 with: path: ~/.cip key: ${{ runner.os }}-build-${{ steps.cache-key.outputs.key }} diff --git a/.github/workflows/static.yml b/.github/workflows/static.yml index 7f72b51..05fa2c9 100644 --- a/.github/workflows/static.yml +++ b/.github/workflows/static.yml @@ -17,7 +17,7 @@ jobs: CIP_TAG: static steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Bootstrap CIP run: |