line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Goo::BackLinkFinder; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
############################################################################### |
4
|
|
|
|
|
|
|
# Nigel Hamilton |
5
|
|
|
|
|
|
|
# |
6
|
|
|
|
|
|
|
# Copyright Nigel Hamilton 2005 |
7
|
|
|
|
|
|
|
# All Rights Reserved |
8
|
|
|
|
|
|
|
# |
9
|
|
|
|
|
|
|
# Author: Nigel Hamilton |
10
|
|
|
|
|
|
|
# Filename: BackLinkFinder.pm |
11
|
|
|
|
|
|
|
# Description: Find all the backlinks for a given "Thing" |
12
|
|
|
|
|
|
|
# |
13
|
|
|
|
|
|
|
# Date Change |
14
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
15
|
|
|
|
|
|
|
# 01/07/2005 Auto generated file |
16
|
|
|
|
|
|
|
# 01/07/2005 Need to find backlinks easily! |
17
|
|
|
|
|
|
|
# |
18
|
|
|
|
|
|
|
############################################################################### |
19
|
|
|
|
|
|
|
|
20
|
1
|
|
|
1
|
|
11713
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
40
|
|
21
|
|
|
|
|
|
|
|
22
|
1
|
|
|
1
|
|
452
|
use Goo::Grepper; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
28
|
|
23
|
1
|
|
|
1
|
|
8
|
use Goo::TypeManager; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
279
|
|
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
#use Smart::Comments; |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
############################################################################### |
29
|
|
|
|
|
|
|
# |
30
|
|
|
|
|
|
|
# get_back_links - return a list of backlinks to this thing |
31
|
|
|
|
|
|
|
# |
32
|
|
|
|
|
|
|
############################################################################### |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub get_back_links { |
35
|
|
|
|
|
|
|
|
36
|
0
|
|
|
0
|
1
|
|
my ($filename) = @_; |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
# show match Perl6 and Perl5 use statements |
39
|
0
|
0
|
|
|
|
|
my $pattern = ($filename =~ /(.*)\.pm$/) ? "use.*?$1" : $filename; |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
# remember the things that match |
42
|
0
|
|
|
|
|
|
my $things = {}; |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
### go through all the different $types of Things |
45
|
0
|
|
|
|
|
|
foreach my $type (Goo::TypeManager::get_all_types()) { |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
#print "looking for this $type \n"; |
48
|
|
|
|
|
|
|
### go through all the different locations |
49
|
0
|
|
|
|
|
|
foreach my $location (Goo::TypeManager::get_type_locations($type)) { |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
#print "looking for this $type in this $location \n"; |
52
|
|
|
|
|
|
|
### grep all the Goo locations for matching files |
53
|
0
|
|
|
|
|
|
my @files = Goo::Grepper::find_files($pattern, $location, $type); |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
### find all the files that contain the pattern |
56
|
0
|
|
|
|
|
|
foreach my $file (@files) { |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
## print "found $file \n"; |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
# split the filename into location and Thing |
61
|
0
|
|
|
|
|
|
$file =~ m/^(.*)\/(.*)$/; |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
# my $location = $1; |
64
|
0
|
|
0
|
|
|
|
my $thing = $2 || $file; |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
# store it in a hash to remove repeats |
67
|
0
|
|
|
|
|
|
$things->{$thing} = 1; |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
##use Goo::Prompter; |
76
|
|
|
|
|
|
|
##Goo::Prompter::dump($things); |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
### found these %$things |
79
|
0
|
|
|
|
|
|
return sort keys %$things; |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
1; |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
__END__ |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=head1 NAME |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
Goo::BackLinkFinder - Find all the backlinks for a given "Thing" |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=head1 SYNOPSIS |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
use Goo::BackLinkFinder; |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=head1 DESCRIPTION |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
Use a simple grep to find backlinks. |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=head1 METHODS |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=over |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=item get_back_links |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
return a list of backlinks to this Thing |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=back |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=head1 AUTHOR |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
Nigel Hamilton <nigel@trexy.com> |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=head1 SEE ALSO |
116
|
|
|
|
|
|
|
|