Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

58 lines (39 sloc) 0.895 kb
package Alien::Base::ModuleBuild::Repository::Local;
use strict;
use warnings;
our $VERSION = '0.000_017';
$VERSION = eval $VERSION;
use Carp;
use File::chdir;
use File::Copy qw/copy/;
use File::Spec;
use parent 'Alien::Base::ModuleBuild::Repository';
sub new {
my $class = shift;
my $self = $class->SUPER::new(@_);
# make location absolute
local $CWD = $self->location;
$self->location("$CWD");
return $self;
}
sub list_files {
my $self = shift;
local $CWD = $self->location;
opendir( my $dh, $CWD);
my @files =
grep { ! /^\./ }
readdir $dh;
return @files;
}
sub get_file {
my $self = shift;
my $file = shift || croak "Must specify file to copy";
my $full_file = do {
local $CWD = $self->location;
croak "Cannot find file: $file" unless -e $file;
File::Spec->rel2abs($file);
};
copy $full_file, $CWD;
return 1;
}
1;
Jump to Line
Something went wrong with that request. Please try again.