1 |
#
|
2 |
# standard url interface for local file
|
3 |
#
|
4 |
# Interface
|
5 |
# ---------
|
6 |
# new() :
|
7 |
# get(url, destination) :
|
8 |
|
9 |
package URL::URL_file;
|
10 |
require 5.001;
|
11 |
use File::Copy;
|
12 |
use URL::URL_interface;
|
13 |
@ISA=qw(URL::URL_interface);
|
14 |
|
15 |
sub get {
|
16 |
my $self=shift;
|
17 |
my $url=shift;
|
18 |
my $location=shift;
|
19 |
|
20 |
my $filename=$url->path();
|
21 |
#print $filename;
|
22 |
if ( -e $filename ) {
|
23 |
copy ( $filename,$location) || die "Unable to copy file $filename --> "
|
24 |
."$location \n$!\n";
|
25 |
$rv=$location;
|
26 |
}
|
27 |
else {
|
28 |
#print "URL_file : Unable to find file $urlfile : $!\n";
|
29 |
$rv="";
|
30 |
}
|
31 |
return $rv;
|
32 |
}
|