ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/SCRAM/src/URL/URLclass.pm
(Generate patch)

Comparing COMP/SCRAM/src/URL/URLclass.pm (file contents):
Revision 1.2 by williamc, Fri Nov 12 16:26:35 1999 UTC vs.
Revision 1.7 by williamc, Fri Nov 12 18:09:20 1999 UTC

# Line 12 | Line 12
12   # url()         : return the full url name with all expansion
13   # expandurl(URLbase) : expand the url to include the given base
14   # file()        : return the filename from the end of the path
15 + # base()        : return the basename of the path
16 + # fullfile()    : return base/file
17   # param(var)    : return the value of a url parameter
18   #
19   # -- specialised use methods
20   # type()        : get/set the url type
21   # vars()        : get/set the vars hash
22 < # base(base)    : push a base into the url path if it dosnt already mactch
22 > # base(base)    : push a base into the url path if it dosnt already match
23   # transfervars(varhash)  : transfer any variables from varhash into vars
24   #                          only if they do not already exist
25  
# Line 59 | Line 61 | sub expandurl {
61          $self->{vars}={};
62          $self->_url($self->{origurl}); # reset the current url;
63          $self->transfervars($base->cmds());
64 <        $self->base($base->base());
64 >        $self->_base($base->base());
65   }
66  
65 sub base {
66        my $self=shift;
67        if ( @_ ) {
68          my $server=shift;
69          if ( ($server ne "") && ($self->{server}!~/\/\//) &&
70                        ($self->{server}!~/$server/) ) {
71             # only set if not already in there
72             $self->{server}=$server."/".$self->{server};
73          }
74        }
75        return $self->{server};
76 }
67  
68   sub url {
69          my $self=shift;
# Line 95 | Line 85 | sub transfervars {
85          }
86   }
87  
88 + sub fullfile {
89 +        my $self=shift;
90 +        return $self->{server}
91 + }
92 +
93 + sub base {
94 +        my $self=shift;
95 +        my $base="";
96 +        if ( $self->{server}=~/\// ) {
97 +          ($base=$self->{server})=~s/(.*)\/.*/$1/;
98 +        }  
99 +        return $base;
100 + }
101 +        
102   sub file {
103          my $self=shift;
104          my $file;
# Line 112 | Line 116 | sub param {
116          my $self=shift;
117          my $param=shift;
118  
119 <        $self->{vars}{'param'};
119 >        $self->{vars}{$param};
120   }
121  
122   #
123   # --- Support Routines
124   #
125 +
126 + # push a base name into the url string
127 + sub _base {
128 +        my $self=shift;
129 +        if ( @_ ) {
130 +          my $server=shift;
131 +          if ( ($server ne "") && ($self->{server}!~/\/\//) &&
132 +                        ($self->{server}!~/$server/) ) {
133 +             # only set if not already in there
134 +             $self->{server}=$server."/".$self->{server};
135 +          }
136 +        }
137 +        return $self->{server};
138 + }
139 +
140   sub _vartostring {
141          my $self=shift;
142  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines