Skip to content

Commit

Permalink
Update exercises and runner to Perl 5.40 (#671)
Browse files Browse the repository at this point in the history
* Add UUID to cpanfile
* Perltidy updates
* STRINGIFY_NUMBERS adjustment
* Include distribution
* Update perl action
* Install UUID to remove warnings
  • Loading branch information
m-dango authored Jun 12, 2024
1 parent d797cf3 commit deeaca5
Show file tree
Hide file tree
Showing 82 changed files with 98 additions and 98 deletions.
16 changes: 9 additions & 7 deletions .github/workflows/exercises.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,26 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: ['ubuntu-22.04', 'macos-12']
perl: ['5.38', '5.36', '5.34', '5.32', '5.30', '5.28', '5.26', '5.24', '5.22', '5.20']
os: ['ubuntu-latest', 'macos-latest']
perl: ['5.40', '5.38', '5.36', '5.34', '5.32', '5.30', '5.28', '5.26', '5.24', '5.22', '5.20']
distribution: ['default']
include:
- os: 'windows-2022'
perl: '5.32'
- os: 'windows-latest'
perl: '5.38'
distribution: strawberry

name: Perl ${{ matrix.perl }} on ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29

- name: Set up perl
uses: shogo82148/actions-setup-perl@28eae78d12c2bba1163aec45d123f6d9228bc307
uses: shogo82148/actions-setup-perl@87c3ad5232e6c1b59da33bfde4fb24b0482901f1
with:
perl-version: ${{ matrix.perl }}
distribution: strawberry
distribution: ${{ matrix.distribution }}

- run: cpm install -g Test2::V0
- run: cpm install -g Test2::V0 UUID

- name: Exercise modules
shell: pwsh
Expand Down
3 changes: 2 additions & 1 deletion cpanfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
requires 'lib::gitroot';
requires 'Data::Dmp';
requires 'Moo';
requires 'namespace::autoclean';
requires 'Path::Tiny';
requires 'Perl::Tidy';
requires 'Template::Mustache';
requires 'Test2::V0';
requires 'TOML::Parser';
requires 'UUID';
requires 'YAML';
requires 'Data::Dmp';
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package BookingUpForBeauty;

use v5.38;
use v5.40;

use Time::Piece;
#use Const::Fast;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package BookingUpForBeauty;

use v5.38;
use v5.40;

# Suggested datetime modules you can use:
#use Time::Piece;
Expand Down
2 changes: 1 addition & 1 deletion exercises/concept/high-score-board/.meta/HighScoreBoard.pm
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package HighScoreBoard;

use v5.38;
use v5.40;

our %Scores;

Expand Down
2 changes: 1 addition & 1 deletion exercises/concept/high-score-board/lib/HighScoreBoard.pm
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package HighScoreBoard;

use v5.38;
use v5.40;

our %Scores;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package InventoryManagement;

use v5.38;
use v5.40;

sub create_inventory ($items) {
my %inventory;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package InventoryManagement;

use v5.38;
use v5.40;

sub create_inventory ($items) {
my %inventory;
Expand Down
2 changes: 1 addition & 1 deletion exercises/concept/language-list/.meta/LanguageList.pm
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package LanguageList;

use v5.38;
use v5.40;
use List::Util qw<any>;

our @Languages;
Expand Down
2 changes: 1 addition & 1 deletion exercises/concept/language-list/lib/LanguageList.pm
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package LanguageList;

use v5.38;
use v5.40;

our @Languages;

Expand Down
2 changes: 1 addition & 1 deletion exercises/concept/lasagna/.meta/Lasagna.pm
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package Lasagna;

use v5.38;
use v5.40;

our $ExpectedMinutesInOven = 40;

Expand Down
2 changes: 1 addition & 1 deletion exercises/concept/lasagna/lib/Lasagna.pm
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package Lasagna;

use v5.38;
use v5.40;

our $ExpectedMinutesInOven = undef;

Expand Down
2 changes: 1 addition & 1 deletion exercises/practice/accumulate/lib/Accumulate.pm
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package Accumulate;

use v5.38;
use v5.40;

use Exporter qw<import>;
our @EXPORT_OK = qw<accumulate>;
Expand Down
2 changes: 1 addition & 1 deletion exercises/practice/all-your-base/lib/AllYourBase.pm
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package AllYourBase;

use v5.38;
use v5.40;

use Exporter qw<import>;
our @EXPORT_OK = qw<rebase>;
Expand Down
2 changes: 1 addition & 1 deletion exercises/practice/allergies/lib/Allergies.pm
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package Allergies;

use v5.38;
use v5.40;

use Exporter qw<import>;
our @EXPORT_OK = qw<allergic_to list_allergies>;
Expand Down
2 changes: 1 addition & 1 deletion exercises/practice/anagram/lib/Anagram.pm
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package Anagram;

use v5.38;
use v5.40;

use Exporter qw<import>;
our @EXPORT_OK = qw<match_anagrams>;
Expand Down
2 changes: 1 addition & 1 deletion exercises/practice/atbash-cipher/lib/AtbashCipher.pm
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package AtbashCipher;

use v5.38;
use v5.40;

use Exporter qw<import>;
our @EXPORT_OK = qw<encode_atbash decode_atbash>;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package BinarySearchTree;

use v5.38;
use v5.40;
use Moo;

package BinarySearchTree::Node {
Expand Down
2 changes: 1 addition & 1 deletion exercises/practice/binary-search/lib/BinarySearch.pm
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package BinarySearch;

use v5.38;
use v5.40;

use Exporter qw<import>;
our @EXPORT_OK = qw<binary_search>;
Expand Down
2 changes: 1 addition & 1 deletion exercises/practice/bob/lib/Bob.pm
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Declare package 'Bob'
package Bob;

use v5.38;
use v5.40;

use Exporter qw<import>;
our @EXPORT_OK = qw<hey>;
Expand Down
2 changes: 1 addition & 1 deletion exercises/practice/bottle-song/lib/BottleSong.pm
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package BottleSong;

use v5.38;
use v5.40;

use Exporter qw<import>;
our @EXPORT_OK = qw<sing>;
Expand Down
2 changes: 1 addition & 1 deletion exercises/practice/clock/lib/Clock.pm
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package Clock;

use v5.38;
use v5.40;
use Moo;

# rwp = read-write protected
Expand Down
14 changes: 7 additions & 7 deletions exercises/practice/clock/t/clock.t
Original file line number Diff line number Diff line change
Expand Up @@ -274,15 +274,15 @@ $todo = undef; # end: 6f8c6541-afac-4a92-b0c2-b10d4e50269f

$todo = todo 'experimental feature' if Clock->new( hour => 0, minute => 0 ) =~ /OBJECT/; # begin: bb9d5a68-e324-4bf5-a75e-0e9b1f97a90d
is(
Clock->new( hour => 17, minute => 3 ),
Clock->new( hour => 17, minute => 3 ),
Clock->new( hour => -31, minute => 3 ),
"Compare two clocks for equality: clocks with negative hour that wraps",
);
$todo = undef; # end: bb9d5a68-e324-4bf5-a75e-0e9b1f97a90d

$todo = todo 'experimental feature' if Clock->new( hour => 0, minute => 0 ) =~ /OBJECT/; # begin: 56c0326d-565b-4d19-a26f-63b3205778b7
is(
Clock->new( hour => 13, minute => 49 ),
Clock->new( hour => 13, minute => 49 ),
Clock->new( hour => -83, minute => 49 ),
"Compare two clocks for equality: clocks with negative hour that wraps multiple times",
);
Expand All @@ -306,39 +306,39 @@ $todo = undef; # end: 533a3dc5-59a7-491b-b728-a7a34fe325de

$todo = todo 'experimental feature' if Clock->new( hour => 0, minute => 0 ) =~ /OBJECT/; # begin: fff49e15-f7b7-4692-a204-0f6052d62636
is(
Clock->new( hour => 2, minute => 40 ),
Clock->new( hour => 2, minute => 40 ),
Clock->new( hour => 3, minute => -20 ),
"Compare two clocks for equality: clocks with negative minute",
);
$todo = undef; # end: fff49e15-f7b7-4692-a204-0f6052d62636

$todo = todo 'experimental feature' if Clock->new( hour => 0, minute => 0 ) =~ /OBJECT/; # begin: 605c65bb-21bd-43eb-8f04-878edf508366
is(
Clock->new( hour => 4, minute => 10 ),
Clock->new( hour => 4, minute => 10 ),
Clock->new( hour => 5, minute => -1490 ),
"Compare two clocks for equality: clocks with negative minute that wraps",
);
$todo = undef; # end: 605c65bb-21bd-43eb-8f04-878edf508366

$todo = todo 'experimental feature' if Clock->new( hour => 0, minute => 0 ) =~ /OBJECT/; # begin: b87e64ed-212a-4335-91fd-56da8421d077
is(
Clock->new( hour => 6, minute => 15 ),
Clock->new( hour => 6, minute => 15 ),
Clock->new( hour => 6, minute => -4305 ),
"Compare two clocks for equality: clocks with negative minute that wraps multiple times",
);
$todo = undef; # end: b87e64ed-212a-4335-91fd-56da8421d077

$todo = todo 'experimental feature' if Clock->new( hour => 0, minute => 0 ) =~ /OBJECT/; # begin: 822fbf26-1f3b-4b13-b9bf-c914816b53dd
is(
Clock->new( hour => 7, minute => 32 ),
Clock->new( hour => 7, minute => 32 ),
Clock->new( hour => -12, minute => -268 ),
"Compare two clocks for equality: clocks with negative hours and minutes",
);
$todo = undef; # end: 822fbf26-1f3b-4b13-b9bf-c914816b53dd

$todo = todo 'experimental feature' if Clock->new( hour => 0, minute => 0 ) =~ /OBJECT/; # begin: e787bccd-cf58-4a1d-841c-ff80eaaccfaa
is(
Clock->new( hour => 18, minute => 7 ),
Clock->new( hour => 18, minute => 7 ),
Clock->new( hour => -54, minute => -11513 ),
"Compare two clocks for equality: clocks with negative hours and minutes that wrap",
);
Expand Down
2 changes: 1 addition & 1 deletion exercises/practice/crypto-square/lib/CryptoSquare.pm
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package CryptoSquare;

use v5.38;
use v5.40;

use Exporter qw<import>;
our @EXPORT_OK = qw<cipher>;
Expand Down
2 changes: 1 addition & 1 deletion exercises/practice/custom-set/lib/CustomSet.pm
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package CustomSet;

use v5.38;
use v5.40;
use Moo;

has elements => (
Expand Down
2 changes: 1 addition & 1 deletion exercises/practice/darts/lib/Darts.pm
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package Darts;

use v5.38;
use v5.40;

use Exporter qw<import>;
our @EXPORT_OK = qw<score_dart>;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package DifferenceOfSquares;

use v5.38;
use v5.40;

use Exporter qw<import>;
our @EXPORT_OK = qw<square_of_sum sum_of_squares difference_of_squares>;
Expand Down
2 changes: 1 addition & 1 deletion exercises/practice/etl/lib/ETL.pm
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package ETL;

use v5.38;
use v5.40;

use Exporter qw<import>;
our @EXPORT_OK = qw<transform>;
Expand Down
2 changes: 1 addition & 1 deletion exercises/practice/food-chain/lib/FoodChain.pm
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package FoodChain;

use v5.38;
use v5.40;

use Exporter qw<import>;
our @EXPORT_OK = qw<recite>;
Expand Down
2 changes: 1 addition & 1 deletion exercises/practice/gigasecond/lib/Gigasecond.pm
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package Gigasecond;

use v5.38;
use v5.40;

use Exporter qw<import>;
our @EXPORT_OK = qw<add_gigasecond>;
Expand Down
2 changes: 1 addition & 1 deletion exercises/practice/grade-school/lib/GradeSchool.pm
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package GradeSchool;

use v5.38;
use v5.40;
use Moo;

sub add ( $self, $student, $grade ) {
Expand Down
2 changes: 1 addition & 1 deletion exercises/practice/grains/lib/Grains.pm
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package Grains;

use v5.38;
use v5.40;

use Exporter qw<import>;
our @EXPORT_OK = qw<grains_on_square total_grains>;
Expand Down
2 changes: 1 addition & 1 deletion exercises/practice/hamming/lib/Hamming.pm
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package Hamming;

use v5.38;
use v5.40;

use Exporter qw<import>;
our @EXPORT_OK = qw<hamming_distance>;
Expand Down
2 changes: 1 addition & 1 deletion exercises/practice/hello-world/lib/HelloWorld.pm
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Declare package 'HelloWorld'
package HelloWorld;

use v5.38;
use v5.40;

use Exporter qw<import>;
our @EXPORT_OK = qw<hello>;
Expand Down
2 changes: 1 addition & 1 deletion exercises/practice/house/lib/House.pm
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package House;

use v5.38;
use v5.40;

use Exporter qw<import>;
our @EXPORT_OK = qw<recite>;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package KindergartenGarden;

use v5.38;
use v5.40;

use Exporter qw<import>;
our @EXPORT_OK = qw<plants>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ properties:
largestProduct:
test: |-
use Data::Dmp;
$Data::Dmp::OPT_STRINGIFY_NUMBERS = 1;
local $Data::Dmp::OPT_STRINGIFY_NUMBERS = 1;
if (!ref $case->{expected}) {
sprintf(<<'END', dmp($case->{input}{digits}), $case->{input}{span}, $case->{expected}, dmp($case->{description}));
is(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package LargestSeriesProduct;

use v5.38;
use v5.40;

use Exporter qw<import>;
our @EXPORT_OK = qw<largest_product>;
Expand Down
Loading

0 comments on commit deeaca5

Please sign in to comment.