App-RegexpPatternUtils

 view release on metacpan or  search on metacpan

script/list-regexp-pattern-patterns  view on Meta::CPAN

                pos => 4,
            },
            gen_args => {
                schema => 'str',
                pos => 5,
            },
            tags => {
                schema => 'str',
                pos => 6,
            },
        },
        pk => 'name',
    },
    table_data => sub {
        require Module::List::Tiny;

        my ($query) = @_;

        my $res = Module::List::Tiny::list_modules(
            'Regexp::Pattern::', {list_modules=>1, recurse=>1});

        #use DD; dd $query;

        my @res;
        for my $mod (sort keys %$res) {
            next if defined $query->{args}{"module.is"} &&
                $query->{args}{"module.is"} ne $mod;
            (my $mod_pm = "$mod.pm") =~ s!::!/!g;
            require $mod_pm;

            my $var = \%{"$mod\::RE"};

            for my $patname (sort keys %$var) {
                my $patspec = $var->{$patname};
                my $rec = {
                    module => $mod,
                    name => $patname,
                    summary => $patspec->{summary},
                    tags => join(",", @{ $patspec->{tags} // [] }),
                };
                if ($patspec->{gen}) {
                    $rec->{is_dynamic} = 1;
                    $rec->{gen_args} =
                        join(",", sort keys %{$patspec->{gen_args} // {}});
                } else {
                    $rec->{is_dynamic} = 0;
                    $rec->{pattern} = "$patspec->{pat}";
                }
                push @res, $rec;
            }
        }
        return {data=>\@res};
    },
);
die "Can't generate function: $res->[0] - $res->[1]" unless $res->[0] == 200;

Perinci::CmdLine::Any->new(
    url => '/main/list_regexp_pattern_patterns',
    read_config => 0,
    read_env => 0,
    use_locale => 1,
)->run;

# ABSTRACT: List Regexp::Pattern::* patterns
# PODNAME: list-regexp-pattern-patterns

__END__

=pod

=encoding UTF-8

=head1 NAME

list-regexp-pattern-patterns - List Regexp::Pattern::* patterns

=head1 VERSION

This document describes version 0.008 of list-regexp-pattern-patterns (from Perl distribution App-RegexpPatternUtils), released on 2022-05-08.

=head1 SYNOPSIS

 % list-regexp-pattern-patterns
 % list-regexp-pattern-patterns -l
 % list-regexp-pattern-patterns -l --exclude-field pattern

=head1 DESCRIPTION

REPLACE ME

=head1 OPTIONS

C<*> marks required options.

=head2 Field selection options

=over

=item B<--detail>, B<-l>

Return array of full records instead of just ID fields.

By default, only the key (ID) field is returned per result entry.


=item B<--exclude-field>=I<s@>

Select fields to return.

Can be specified multiple times.

=item B<--exclude-fields-json>=I<s>

Select fields to return (JSON-encoded).

See C<--exclude-field>.

=item B<--field>=I<s@>

Select fields to return.



( run in 1.687 second using v1.01-cache-2.11-cpan-ceb78f64989 )