Name.pm

filter: Statementstmt 87.5% 14 / 16 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 80.0% 4 / 5 Podpod n/a totaltotal 85.7% 18 / 21 CC 1 SCAR 1.8
CC
1
Cov
88%
_genKey
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.2
« Content.pm ↑ Summary
1 #================================= Name.pm ===================================
2 # Filename: Name.pm
3 # Description: Generalized hash by full path of file information.
4 # Original Author: Dale M. Amon
5 # Revised by: $Author: amon $
6 # Date: $Date: 2008-08-28 23:35:28 $
7 # Version: $Revision: 1.7 $
8 # License: LGPL 2.1, Perl Artistic or BSD
9 #
10 #=============================================================================
11 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 1 ▶use FileHash::Base;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 1 ▶use FileHash::Entry;
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 package FileHash::Name;
16 1 ▶use vars qw{@ISA};
Subroutine BEGIN: called CC=1 SCAR=0.0
17 1 @ISA = qw( FileHash::Base );
18  
19 #=============================================================================
20 # FAMILY METHODS
21 #=============================================================================
22  
23 0 ▶sub _genKey {my ($s,$entry) = @_; return $entry->file;}
Subroutine _genKey: not called CC=1 SCAR=6.9
24
25 #=============================================================================
26 # POD DOCUMENTATION
27 #=============================================================================
28 # You may extract and format the documention section with the 'perldoc' cmd.
29  
30 =head1 NAME
31  
32 FileHash::Name - A Hash of file data keyed by the file's name.
33  
34 =head1 SYNOPSIS
35  
36 use FileHash::Name;
37 $obj = FileHash::Name->alloc;
38  
39 =head1 Inheritance
40  
41 FileHash::Base
42  
43 =head1 Description
44  
45 This is a container for lists of file name entries. It modifies the
46 definition of hash to to be the file name portion of the absolute path. For
47 instance:
48  
49 /my/directory/foo.jpg
50  
51 would be hashed as foo.jpg so that all instances of that name will be
52 added to the same bucket.
53  
54 Other than the hash key definition, it inherits its behavior from FileHash::Base.
55  
56 =head1 Examples
57  
58 use FileHash::Content;
59 my $a = FileHash::Name->alloc;
60 $a->initFromTree ("/root");
61  
62 =head1 Class Variables
63  
64 None.
65  
66 =head1 Instance Variables
67  
68 None.
69  
70 =head1 Class Methods
71  
72 =over 4
73  
74 =item B<$obj = FileHash::Name-E<gt>alloc>
75  
76 Allocate an empty instance of FileHash::Name.
77  
78 =back 4
79  
80 =head1 Instance Methods
81  
82 See FileHash::Base.
83  
84 =head1 Private Class Method
85  
86 None.
87  
88 =head1 Private Instance Methods
89  
90 =over 4
91  
92 =item B<$key = $obj-E<gt>_genKey($entry)>
93  
94 Create an appropriate hash key. If needed values are undef,
95 it will generate a name of "" for the key.
96  
97 =back 4
98  
99 =head1 Errors and Warnings
100  
101 Lots.
102  
103 =head1 KNOWN BUGS
104  
105 See TODO.
106  
107 =head1 SEE ALSO
108  
109 FileHash::Base, FileHash::Entry.
110  
111 =head1 AUTHOR
112  
113 Dale Amon <amon@vnl.com>
114  
115 =cut
116
117 #=============================================================================
118 # CVS HISTORY
119 #=============================================================================
120 # $Log: Name.pm,v $
121 # Revision 1.7 2008-08-28 23:35:28 amon
122 # perldoc section regularization.
123 #
124 # Revision 1.6 2008-08-04 12:15:12 amon
125 # Changed 'use' list.
126 #
127 # Revision 1.5 2008-07-27 15:16:17 amon
128 # Wrote lexical parse for Entry; error checking on eval and other minor issues.
129 #
130 # Revision 1.4 2008-07-25 14:30:42 amon
131 # Documentation improvements and corrections.
132 #
133 # Revision 1.3 2008-07-24 13:35:26 amon
134 # switch to NeXT style alloc/init format for FileHash and Entry classes.
135 #
136 # Revision 1.2 2008-07-23 21:12:24 amon
137 # Moved notes out of file headers; a few doc updates; added assertion checks;
138 # minor bug fixes.
139 #
140 # 20080717 Dale Amon <amon@vnl.com>
141 # Split FilenameHash, formerly Directory class, into FileHash
142 # FileHash::Name and FileHash::Content.
143 # 20080625 Dale Amon <amon@vnl.com>
144 # Created Directory class.
145 1 1;
« Content.pm ↑ Summary