mason/.perl-lib/TrivGal.pm (listdir): Refactor how the index flag is set.
authorMark Wooding <mdw@distorted.org.uk>
Mon, 12 Jun 2023 10:44:41 +0000 (11:44 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Mon, 12 Jun 2023 10:49:08 +0000 (11:49 +0100)
Match a collection of flag characters, though only `!' is currently
recognized, and then set the flags based on what we see.

mason/.perl-lib/TrivGal.pm

index e329e00..b47835a 100644 (file)
@@ -303,12 +303,13 @@ sub listdir ($) {
        $comment = defined $comment ? $comment . "\n" . $_ : $_;
       } else {
        if ($item && $comment) { $item->comment($comment); }
-       my ($indexp, $name, $c) =
-         /^ (! \s+)?                   # index flag
+       my ($flags, $name, $c) =
+         /^ (?: ([!]+) \s+)?           # flags
             (\S+) \s*                  # filename
             (\S | \S.*\S )?            # start of the comment
             \s*
             $/x;
+       my $indexp = $flags =~ /!/;
        $name = urldecode $name;
        my $list;
        $item = TrivGal::Item->new($name);