File: Dir.pm

package info (click to toggle)
libvcs-perl 0.14-3
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 264 kB
  • ctags: 282
  • sloc: perl: 1,083; makefile: 567
file content (31 lines) | stat: -rw-r--r-- 708 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package VCS::Rcs::Dir;

use Carp;

@ISA = qw(VCS::Rcs VCS::Dir);

use strict;

sub new {
    my($class, $url) = @_;
    my $self = $class->init($url);
    my $path = $self->path;
    die "$class->new: $path: $!\n" unless -d $path;
    die "$class->new: $path not an RCS directory: $!\n"
        unless -d $path . 'RCS' or glob "$path*,v";
    $self;
}

# evil assumption - no query string!
sub content {
    my $self = shift;
    my $base_dir = $self->path;
    sort map {
        my $new_class = -d "$base_dir$_" ? 'VCS::Rcs::Dir' : 'VCS::Rcs::File';
        $new_class->new($self->url . $_);
    } grep {
        (!/^RCS$/) && (-f "$base_dir$_" || -d "$base_dir$_")
    } $self->read_dir($base_dir);
}

1;