ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/SCRAM/src/Cache/Cache.pm
(Generate patch)

Comparing COMP/SCRAM/src/Cache/Cache.pm (file contents):
Revision 1.3 by sashby, Fri Mar 11 18:55:28 2005 UTC vs.
Revision 1.5 by sashby, Wed Aug 17 11:20:54 2005 UTC

# Line 10 | Line 10
10   # Copyright: 2003 (C) Shaun Ashby
11   #
12   #--------------------------------------------------------------------
13 +
14 + =head1 NAME
15 +
16 + Cache::Cache - A generic directory cache object.
17 +
18 + =head1 SYNOPSIS
19 +
20 +        my $obj = Cache::Cache->new();
21 +
22 + =head1 DESCRIPTION
23 +
24 + A package to provide caching of directory information. Directory timestamps
25 + are tracked on further reading of an existing cache and lists of modified
26 + directories and BuildFiles can be obtained.
27 +
28 + =head1 METHODS
29 +
30 + =over
31 +
32 + =cut
33 +
34   package Cache::Cache;
35   require 5.004;
36  
37   use Exporter;
38   @ISA=qw(Exporter);
39   #
40 +
41 + =item   C<new()>
42 +
43 + Create a new Cache::Cache object. The name of the cache is B<DirCache.db> by default.
44 +
45 + =cut
46 +
47   sub new()
48     ###############################################################
49     # new                                                         #
# Line 42 | Line 70 | sub new()
70     return $self;
71     }
72  
73 + =item   C<getdir($path)>
74 +
75 +
76 +
77 + =cut
78 +
79   sub getdir()
80     {
81     my $self=shift;
82     my ($path) = @_;
83     opendir (DIR, $path) || die "$path: cannot read: $!\n";
84 <   # Skip .admin subdirectories too.
84 >   # Skip .admin and CVS subdirectories too.
85     # Also skip files that look like backup files or files being modified with emacs:
86     my @items = map { "$path/$_" } grep (
87 <                                        $_ ne "." && $_ ne ".." &&
87 >                                        $_ ne "." && $_ ne ".." && $_ ne "CVS" &&
88                                          $_ ne ".admin" && $_ !~ m|\.#*|,
89                                          readdir(DIR)
90                                          );  
# Line 82 | Line 116 | sub checktree()
116     # non-directories unless $dofiles is set.  Considering only directories is
117     # dramatically faster.
118     next if ($path =~ /\.admin/); # skip .admin dirs
119 +   next if ($path =~ /.*CVS/);
120  
121     # NB: We stat each path only once ever.  The special "_" file handle uses
122     # the results from the last stat we've made.  See man perlfunc/stat.
# Line 484 | Line 519 | sub name()
519     }
520  
521   1;
522 +
523 + =back
524 +
525 + =head1 AUTHOR
526 +
527 + Shaun Ashby (with contribution from Lassi Tuura)
528 +
529 + =head1 MAINTAINER
530 +
531 + Shaun Ashby
532 +  
533 + =cut
534 +

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines