home *** CD-ROM | disk | FTP | other *** search
/ CLIX - Fazer Clix Custa Nix / CLIX-CD.cdr / mac / lib / auto / URI / URL / _generic / path.al < prev    next >
Encoding:
Text File  |  1997-04-07  |  800 b   |  30 lines  |  [TEXT/McPL]

  1. # NOTE: Derived from ./blib/lib/URI/URL/_generic.pm.  Changes made here will be lost.
  2. package URI::URL::_generic;
  3.  
  4. sub path {
  5.     my $self = shift;
  6.     my $old = $self->_elem('path',
  7.                map { uri_escape($_,
  8.                         $URI::URL::reserved_no_slash)
  9.                    } @_);
  10.  
  11.     if ($URI::URL::COMPAT_VER_3) {
  12.     # We used to get rid of the leading "/" in the path
  13.     if (defined $old) {
  14.         $old =~ s|^/||;
  15.         Carp::croak("Path components contain '/' (you must call epath)")
  16.         if $old =~ /%2[fF]/;
  17.         return uri_unescape($old);
  18.     }
  19.     return undef;
  20.     }
  21.  
  22.     return '/' if !defined($old) || !length($old);
  23.     Carp::croak("Path components contain '/' (you must call epath)")
  24.     if $old =~ /%2[fF]/ and !@_;
  25.     $old = "/$old" if $old !~ m|^/| && defined $self->{'netloc'};
  26.     return uri_unescape($old);
  27. }
  28.  
  29. 1;
  30.