From 17f6f6942107d0aa7683800cea042abee29c9412 Mon Sep 17 00:00:00 2001 From: Graham Knop Date: Sat, 5 Oct 2024 04:33:40 +0200 Subject: [PATCH] allow strings for backup script index option Using command line options, the index option will always be assigned as an arrayref. But the default was still a plain string, which would error if no index option was given. The default could be changed to an array ref, but it also makes sense to coerce a normal string. --- lib/MetaCPAN/Types/TypeTiny.pm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/MetaCPAN/Types/TypeTiny.pm b/lib/MetaCPAN/Types/TypeTiny.pm index d63ac5808..deea5f7a4 100644 --- a/lib/MetaCPAN/Types/TypeTiny.pm +++ b/lib/MetaCPAN/Types/TypeTiny.pm @@ -132,5 +132,8 @@ declare CommaSepOption, as ArrayRef [ StrMatch [qr{^[^, ]+$}] ]; coerce CommaSepOption, from ArrayRef [Str], via { return [ map split(/\s*,\s*/), @$_ ]; }; +coerce CommaSepOption, from Str, via { + return [ map split(/\s*,\s*/), $_ ]; +}; 1;