| 1 | package Parse::Path::DZIL; | ||
| 2 | |||
| 3 | 3 | our $VERSION = '0.92'; # VERSION | |
| 4 | # ABSTRACT: "dist.ini-style".paths.for.DZIL[0] | ||
| 5 | |||
| 6 | ############################################################################# | ||
| 7 | # Modules | ||
| 8 | |||
| 9 | 3 | ▶ | use Moo; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 10 | 3 | ▶ | use sanity; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 11 | |||
| 12 | 3 | ▶ | use String::Escape; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 13 | |||
| 14 | 3 | ▶ | use namespace::clean; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 15 | 3 | ▶ | no warnings 'uninitialized'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 16 | |||
| 17 | ############################################################################# | ||
| 18 | # Required Methods | ||
| 19 | |||
| 20 | 3 | with 'Parse::Path::Role::Path'; | |
| 21 | |||
| 22 | 19 | ▶ | sub _build_blueprint { { |
|
Subroutine
_build_blueprint: called CC=1 SCAR=0.0
| |||
| 23 | hash_step_regexp => qr/ | ||
| 24 | # Standard character (or a zero-length with a delimiter) | ||
| 25 | (?<key>\w+|(?=\.))| | ||
| 26 | |||
| 27 | # Quoted key | ||
| 28 | (?<quote>['"])(?<key> (?: | ||
| 29 | |||
| 30 | # The (?!) is a fancy way of saying ([^\"\\]*) with a variable quote character | ||
| 31 | (?>(?: (?! \\|\g{quote}). )*) | # Most stuff (no backtracking) | ||
| 32 | \\ \g{quote} | # Escaped quotes | ||
| 33 | \\ (?! \g{quote}) # Any other escaped character | ||
| 34 | |||
| 35 | )* )\g{quote}| | ||
| 36 | |||
| 37 | # Zero-length step (with a single blank key) | ||
| 38 | (?<key>^$) | ||
| 39 | /x, | ||
| 40 | |||
| 41 | array_step_regexp => qr/\[(?<key>\d{1,5})\]/, | ||
| 42 | delimiter_regexp => qr/(?:\.|(?=\[))/, | ||
| 43 | |||
| 44 | unescape_translation => [ | ||
| 45 | [qr/\"/ => \&String::Escape::unbackslash], | ||
| 46 | 4 | ▶ | [qr/\'/ => sub { my $str = $_[0]; $str =~ s|\\([\'\\])|$1|g; $str; }], |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 47 | ], | ||
| 48 | pos_translation => [ | ||
| 49 | [qr/.?/, 'X+1'], | ||
| 50 | ], | ||
| 51 | |||
| 52 | delimiter_placement => { | ||
| 53 | HH => '.', | ||
| 54 | AH => '.', | ||
| 55 | }, | ||
| 56 | |||
| 57 | array_key_sprintf => '[%u]', | ||
| 58 | hash_key_stringification => [ | ||
| 59 | [qr/[\x00-\x1f\']/, | ||
| 60 | '"%s"' => \&String::Escape::backslash], | ||
| 61 | 19 | ▶ | [qr/\W|^$/, "'%s'" => sub { my $str = $_[0]; $str =~ s|([\'\\])|\\$1|g; $str; }], |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 62 | [qr/.?/, '%s'], | ||
| 63 | ], | ||
| 64 | } } | ||
| 65 | |||
| 66 | 3 | 42; | |
| 67 | |||
| 68 | __END__ | ||