| 1 | package Sah::Schema::perl::sorter::modname_with_optional_args; | ||
| 2 | |||
| 3 | 1 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | |||
| 5 | 1 | our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY | |
| 6 | 1 | our $DATE = '2024-01-23'; # DATE | |
| 7 | 1 | our $DIST = 'Sah-Schemas-Sorter'; # DIST | |
| 8 | 1 | our $VERSION = '0.001'; # VERSION | |
| 9 | |||
| 10 | 1 | our $schema = [str => { | |
| 11 | summary => 'Perl Sorter::* module name without the prefix (e.g. Foo::bar) with optional arguments (e.g. Foo::baz,qux,quux)', | ||
| 12 | description => <<'_', | ||
| 13 | |||
| 14 | Perl Sorter::* module name without the prefix, with optional arguments which | ||
| 15 | will be used as import arguments, just like the `-MMODULE=ARGS` shortcut that | ||
| 16 | `perl` provides. Examples: | ||
| 17 | |||
| 18 | Foo::bar | ||
| 19 | Foo::baz=qux,quux | ||
| 20 | Foo::baz,qux,quux | ||
| 21 | |||
| 22 | See also: `perl::sorter::modname`. | ||
| 23 | |||
| 24 | _ | ||
| 25 | match => '\A[A-Za-z_][A-Za-z_0-9]*(::[A-Za-z_0-9]+)*(?:=.*)?\z', | ||
| 26 | |||
| 27 | 'prefilters' => [ | ||
| 28 | 'Perl::normalize_perl_modname', | ||
| 29 | ], | ||
| 30 | |||
| 31 | # XXX also provide completion for arguments | ||
| 32 | 'x.completion' => ['perl_sorter_modname_with_optional_args'], | ||
| 33 | |||
| 34 | examples => [ | ||
| 35 | {value=>'', valid=>0}, | ||
| 36 | {value=>'Foo/Bar', valid=>1, validated_value=>'Foo::Bar'}, | ||
| 37 | {value=>'Foo/Bar=a,1,b,2', valid=>1, validated_value=>'Foo::Bar=a,1,b,2'}, | ||
| 38 | {value=>'Foo bar', valid=>0}, | ||
| 39 | ], | ||
| 40 | |||
| 41 | }]; | ||
| 42 | |||
| 43 | 1 | 1; | |
| 44 | # ABSTRACT: | ||
| 45 | |||
| 46 | __END__ | ||