| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | # ABSTRACT: Names your elasticsearch index after your distribution as defined in dist.ini | 
| 2 |  |  |  |  |  |  | # PODNAME: App::Prove::Elasticsearch::Indexer::DzilDist | 
| 3 |  |  |  |  |  |  |  | 
| 4 |  |  |  |  |  |  | package App::Prove::Elasticsearch::Indexer::DzilDist; | 
| 5 |  |  |  |  |  |  | $App::Prove::Elasticsearch::Indexer::DzilDist::VERSION = '0.001'; | 
| 6 | 1 |  |  | 1 |  | 1456 | use strict; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 21 |  | 
| 7 | 1 |  |  | 1 |  | 4 | use warnings; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 25 |  | 
| 8 |  |  |  |  |  |  |  | 
| 9 | 1 |  |  | 1 |  | 321 | use parent qw{App::Prove::Elasticsearch::Indexer}; | 
|  | 1 |  |  |  |  | 223 |  | 
|  | 1 |  |  |  |  | 4 |  | 
| 10 |  |  |  |  |  |  |  | 
| 11 |  |  |  |  |  |  | #Basically, do this: | 
| 12 |  |  |  |  |  |  | #our $index = `awk '/^name/ {print \$NF}' dist.ini`; | 
| 13 |  |  |  |  |  |  |  | 
| 14 |  |  |  |  |  |  | our $index = __CLASS__->SUPER::index; | 
| 15 |  |  |  |  |  |  | our $dfile //= 'dist.ini'; | 
| 16 |  |  |  |  |  |  |  | 
| 17 |  |  |  |  |  |  | if (open(my $dh, '<', $dfile)) { | 
| 18 |  |  |  |  |  |  | while (<$dh>) { | 
| 19 |  |  |  |  |  |  | ($index) = $_ =~ /^name\s*?=\s*?(.*)/; | 
| 20 |  |  |  |  |  |  | if ($index) { | 
| 21 |  |  |  |  |  |  | $index =~ s/^\s+//; | 
| 22 |  |  |  |  |  |  | last; | 
| 23 |  |  |  |  |  |  | } | 
| 24 |  |  |  |  |  |  | } | 
| 25 |  |  |  |  |  |  | close $dh; | 
| 26 |  |  |  |  |  |  | } else { | 
| 27 |  |  |  |  |  |  | print | 
| 28 |  |  |  |  |  |  | "# WARNING: Could not open $dfile, falling back to index name '$index'\n"; | 
| 29 |  |  |  |  |  |  | } | 
| 30 |  |  |  |  |  |  |  | 
| 31 |  |  |  |  |  |  | 1; | 
| 32 |  |  |  |  |  |  |  | 
| 33 |  |  |  |  |  |  | __END__ |