| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package Alien::Build::Log::Abbreviate; | 
| 2 |  |  |  |  |  |  |  | 
| 3 | 2 |  |  | 2 |  | 202867 | use strict; | 
|  | 2 |  |  |  |  | 9 |  | 
|  | 2 |  |  |  |  | 58 |  | 
| 4 | 2 |  |  | 2 |  | 10 | use warnings; | 
|  | 2 |  |  |  |  | 4 |  | 
|  | 2 |  |  |  |  | 50 |  | 
| 5 | 2 |  |  | 2 |  | 62 | use 5.008004; | 
|  | 2 |  |  |  |  | 7 |  | 
| 6 | 2 |  |  | 2 |  | 1133 | use Term::ANSIColor (); | 
|  | 2 |  |  |  |  | 15686 |  | 
|  | 2 |  |  |  |  | 161 |  | 
| 7 | 2 |  |  | 2 |  | 892 | use Path::Tiny qw( path ); | 
|  | 2 |  |  |  |  | 11211 |  | 
|  | 2 |  |  |  |  | 162 |  | 
| 8 | 2 |  |  | 2 |  | 524 | use File::chdir; | 
|  | 2 |  |  |  |  | 2866 |  | 
|  | 2 |  |  |  |  | 263 |  | 
| 9 | 2 |  |  | 2 |  | 444 | use parent qw( Alien::Build::Log ); | 
|  | 2 |  |  |  |  | 281 |  | 
|  | 2 |  |  |  |  | 15 |  | 
| 10 |  |  |  |  |  |  |  | 
| 11 |  |  |  |  |  |  | # ABSTRACT: Log class for Alien::Build which is less verbose | 
| 12 |  |  |  |  |  |  | our $VERSION = '2.47'; # VERSION | 
| 13 |  |  |  |  |  |  |  | 
| 14 |  |  |  |  |  |  |  | 
| 15 |  |  |  |  |  |  | sub _colored | 
| 16 |  |  |  |  |  |  | { | 
| 17 | 0 |  |  | 0 |  |  | my($code, @out) = @_; | 
| 18 | 0 | 0 |  |  |  |  | -t STDOUT ? Term::ANSIColor::colored($code, @out) : @out; | 
| 19 |  |  |  |  |  |  | } | 
| 20 |  |  |  |  |  |  |  | 
| 21 |  |  |  |  |  |  | my $root = path("$CWD"); | 
| 22 |  |  |  |  |  |  |  | 
| 23 |  |  |  |  |  |  | sub log | 
| 24 |  |  |  |  |  |  | { | 
| 25 | 0 |  |  | 0 | 1 |  | my(undef, %args) = @_; | 
| 26 | 0 |  |  |  |  |  | my($message) = $args{message}; | 
| 27 | 0 |  |  |  |  |  | my ($package, $filename, $line) = @{ $args{caller} }; | 
|  | 0 |  |  |  |  |  |  | 
| 28 |  |  |  |  |  |  |  | 
| 29 | 0 |  |  |  |  |  | my $source = $package; | 
| 30 | 0 |  |  |  |  |  | $source =~ s/^Alien::Build::Auto::[^:]+::Alienfile/alienfile/; | 
| 31 |  |  |  |  |  |  |  | 
| 32 | 0 |  |  |  |  |  | my $expected = $package; | 
| 33 | 0 | 0 |  |  |  |  | $expected .= '.pm' unless $package eq 'alienfile'; | 
| 34 | 0 |  |  |  |  |  | $expected =~ s/::/\//g; | 
| 35 | 0 | 0 |  |  |  |  | if($filename !~ /\Q$expected\E$/) | 
| 36 |  |  |  |  |  |  | { | 
| 37 | 0 |  |  |  |  |  | $source = path($filename)->relative($root); | 
| 38 |  |  |  |  |  |  | } | 
| 39 |  |  |  |  |  |  | else | 
| 40 |  |  |  |  |  |  | { | 
| 41 | 0 |  |  |  |  |  | $source =~ s/^Alien::Build::Plugin/ABP/; | 
| 42 | 0 |  |  |  |  |  | $source =~ s/^Alien::Build/AB/; | 
| 43 |  |  |  |  |  |  | } | 
| 44 |  |  |  |  |  |  |  | 
| 45 | 0 |  |  |  |  |  | print _colored([ "bold on_black"          ], '['); | 
| 46 | 0 |  |  |  |  |  | print _colored([ "bright_green on_black"  ], $source); | 
| 47 | 0 |  |  |  |  |  | print _colored([ "on_black"               ], ' '); | 
| 48 | 0 |  |  |  |  |  | print _colored([ "bright_yellow on_black" ], $line); | 
| 49 | 0 |  |  |  |  |  | print _colored([ "bold on_black"          ], ']'); | 
| 50 | 0 |  |  |  |  |  | print _colored([ "white on_black"         ], ' ', $message); | 
| 51 | 0 |  |  |  |  |  | print "\n"; | 
| 52 |  |  |  |  |  |  | } | 
| 53 |  |  |  |  |  |  |  | 
| 54 |  |  |  |  |  |  | 1; | 
| 55 |  |  |  |  |  |  |  | 
| 56 |  |  |  |  |  |  | __END__ |