1 |
williamc |
1.1 |
#
|
2 |
|
|
# standard url interface - dummy implementation
|
3 |
|
|
#
|
4 |
|
|
# Interface
|
5 |
|
|
# ---------
|
6 |
|
|
# new() : new object - calls init ->override init
|
7 |
|
|
# setbase() : Override as reqd
|
8 |
|
|
# unsetbase() : Override as reqd
|
9 |
|
|
# get(url, destination) : Override
|
10 |
|
|
# getfilefrompath($path) : Return the filename cut out from a url
|
11 |
|
|
|
12 |
|
|
|
13 |
williamc |
1.2 |
package URL::URL_base;
|
14 |
williamc |
1.1 |
require 5.001;
|
15 |
|
|
|
16 |
|
|
sub new {
|
17 |
|
|
my $class=shift;
|
18 |
|
|
$self={};
|
19 |
|
|
bless $self, $class;
|
20 |
|
|
$self->init();
|
21 |
|
|
return $self;
|
22 |
|
|
}
|
23 |
|
|
|
24 |
|
|
# ----- Dummy interface routines
|
25 |
|
|
sub init {
|
26 |
|
|
# Dummy - override as reqd
|
27 |
|
|
}
|
28 |
|
|
|
29 |
|
|
sub setbase {
|
30 |
|
|
# Dummy - override as reqd
|
31 |
|
|
}
|
32 |
|
|
|
33 |
|
|
sub unsetbase {
|
34 |
|
|
# Dummy - override as reqd
|
35 |
|
|
}
|
36 |
|
|
|
37 |
|
|
sub get {
|
38 |
|
|
# Dummy - override as reqd
|
39 |
|
|
}
|
40 |
|
|
|
41 |
|
|
#
|
42 |
|
|
# Utility Routines
|
43 |
|
|
#
|
44 |
|
|
sub getfilefrompath {
|
45 |
|
|
my $self=shift;
|
46 |
|
|
my $path=shift;
|
47 |
|
|
|
48 |
|
|
my $file;
|
49 |
|
|
|
50 |
|
|
if ( $path=~/\// ) {
|
51 |
|
|
($file=$path)=~s/.*\///g;
|
52 |
|
|
}
|
53 |
|
|
else {
|
54 |
|
|
$file=$path;
|
55 |
|
|
}
|
56 |
|
|
return $file;
|
57 |
|
|
}
|