script/source_location.pl untested

filter: Statementstmt 0.0% 0 / 36 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 8 MC/DCmcdc 0.0% 0 / 5 Subroutinesub 0.0% 0 / 8 Podpod n/a totaltotal 0.0% 0 / 61 CC 1 SCAR 6.9
CC
1
Cov
0%
BEGIN
2.0
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1 #!/usr/bin/env perl
2 use strict;
3 use warnings;
4 use lib 'lib';
5 use lib 't/lib';
6 use Term::ANSIColor qw(colored);
7 use UNIVERSAL::require;
8 use UNIVERSAL::source_location_for;
9 use Pod::Usage;
10 my ($class, $method) = @ARGV;
11 unless ($class && $method) {
12 pod2usage;
13 }
14  
15 $class->require or die $@;
16 my ($file, $line) = do {
17 local $SIG{__WARN__} = sub {};
18 $class->source_location_for($method)
19 };
20  
21 unless (defined($file) && defined($line)) {
22 print colored(qq|method "${class}::$method" is not found.|, 'red'), "\n";
23 exit 1;
24 }
25  
26 print colored('FILENAME ', 'green') . "$file\n";
27 print colored('LINE ', 'green') . "$line\n";
28  
29 =encoding utf-8
30  
31 =head1 SYNOPSIS
32  
33 $ source_location.pl <Module> <method>
34  
35 =cut