| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package App::PRT::Util::DestinationFile; | 
| 2 | 5 |  |  | 5 |  | 1400 | use strict; | 
|  | 5 |  |  |  |  | 6 |  | 
|  | 5 |  |  |  |  | 117 |  | 
| 3 | 5 |  |  | 5 |  | 13 | use warnings; | 
|  | 5 |  |  |  |  | 7 |  | 
|  | 5 |  |  |  |  | 109 |  | 
| 4 | 5 |  |  | 5 |  | 16 | use Path::Class; | 
|  | 5 |  |  |  |  | 5 |  | 
|  | 5 |  |  |  |  | 1044 |  | 
| 5 |  |  |  |  |  |  |  | 
| 6 |  |  |  |  |  |  |  | 
| 7 |  |  |  |  |  |  | sub destination_file { | 
| 8 | 21 |  |  | 21 | 0 | 4370 | my ($source_class_name, $destination_class_name, $input_file) = @_; | 
| 9 |  |  |  |  |  |  |  | 
| 10 | 21 |  |  |  |  | 26 | my @delimiters = do { | 
| 11 | 21 |  |  |  |  | 23 | my $pattern = $source_class_name; | 
| 12 | 21 |  |  |  |  | 54 | $pattern =~ s{::}{(.+)}g; | 
| 13 | 21 |  |  |  |  | 443 | ($input_file =~ qr/^(.*)$pattern(.*)$/); | 
| 14 |  |  |  |  |  |  | }; | 
| 15 | 21 |  |  |  |  | 50 | my $prefix = shift @delimiters; | 
| 16 | 21 |  |  |  |  | 24 | my $suffix = pop @delimiters; | 
| 17 |  |  |  |  |  |  |  | 
| 18 | 21 |  |  |  |  | 27 | my $fallback_delimiter = $delimiters[-1]; | 
| 19 | 21 |  |  |  |  | 77 | my $dir = file($input_file)->dir; | 
| 20 | 21 |  |  |  |  | 2243 | $dir = $dir->parent for grep { $_ eq '/' } @delimiters; | 
|  | 21 |  |  |  |  | 71 |  | 
| 21 | 21 |  |  |  |  | 795 | my $basename = $destination_class_name; | 
| 22 | 21 |  |  |  |  | 68 | $basename =~ s{::}{ | 
| 23 | 23 |  | 66 |  |  | 72 | shift @delimiters // $fallback_delimiter; | 
| 24 |  |  |  |  |  |  | }ge; | 
| 25 | 21 |  |  |  |  | 76 | $dir->file("$basename$suffix")->stringify; | 
| 26 |  |  |  |  |  |  | } | 
| 27 |  |  |  |  |  |  |  | 
| 28 |  |  |  |  |  |  | 1; |