ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/SCRAM/src/URL/URL_filed.pm
Revision: 1.2
Committed: Fri Jan 14 17:36:43 2011 UTC (14 years, 4 months ago) by muzaffar
Content type: text/plain
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +0 -0 lines
State: FILE REMOVED
Log Message:
merged SCRAM_V2 branch in to head

File Contents

# Content
1 #
2 # standard url interface for local file - direct use no copying to cache
3 #
4 # Interface
5 # ---------
6 # new() :
7 # setbase() :
8 # unsetbase() :
9 # get(url, destination) :
10
11 package URL::URL_filed;
12 require 5.001;
13 use File::Copy;
14 use URL::URL_base;
15 @ISA=qw(URL::URL_base);
16
17 sub new {
18 my $class=shift;
19 $self={};
20 bless $self, $class;
21 $self->{path}="";
22 return $self;
23 }
24
25 sub setbase {
26 my $self=shift;
27 my $varhash=shift;
28
29 if ( exists $$varhash{'base'} ) {
30 $self->{path}=$$varhash{'base'};
31 }
32 }
33
34 sub unsetbase {
35 my $self=shift;
36 $self->{path}="";
37 }
38
39 sub get {
40 my $self=shift;
41 my $file=shift;
42 my $dir=shift; # Were not copying anything so this is irrelevant
43
44 my $rv="";
45 my $urlfile=$file;
46
47 if ( $file!~/^\// ) {
48 $urlfile=$self->{path}."/".$file;
49 }
50 if ( -e "$urlfile" ) {
51 $rv=$urlfile;
52 }
53 return $rv;
54 }