ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/SCRAM/src/URL/URL_file.pm
Revision: 1.10
Committed: Tue Nov 28 13:35:38 2000 UTC (24 years, 5 months ago) by williamc
Content type: text/plain
Branch: MAIN
Changes since 1.9: +8 -1 lines
Log Message:
Add directory copy facility

File Contents

# User Rev Content
1 williamc 1.1 #
2     # standard url interface for local file
3     #
4     # Interface
5     # ---------
6     # new() :
7     # get(url, destination) :
8    
9 williamc 1.4 package URL::URL_file;
10 williamc 1.1 require 5.001;
11     use File::Copy;
12 williamc 1.9 use URL::URL_base;
13     @ISA=qw(URL::URL_base);
14 williamc 1.1
15     sub get {
16     my $self=shift;
17 williamc 1.5 my $url=shift;
18     my $location=shift;
19 williamc 1.1
20 williamc 1.8 my $filename=$url->path();
21 williamc 1.6 #print $filename;
22 williamc 1.5 if ( -e $filename ) {
23 williamc 1.10 if ( -d $filename ) { #- directory copy
24     require Utilities::AddDir;
25     print $filename." ".$location."\n";
26     AddDir::copydir($filename,$location);
27     }
28     else {
29     copy ( $filename,$location) || die "Unable to copy file $filename --> "
30 williamc 1.5 ."$location \n$!\n";
31 williamc 1.10 }
32 williamc 1.5 $rv=$location;
33 williamc 1.1 }
34     else {
35 williamc 1.5 #print "URL_file : Unable to find file $urlfile : $!\n";
36 williamc 1.3 $rv="";
37 williamc 1.1 }
38 williamc 1.3 return $rv;
39 williamc 1.1 }