home *** CD-ROM | disk | FTP | other *** search
/ CLIX - Fazer Clix Custa Nix / CLIX-CD.cdr / mac / lib / URI / URL / wais.pm < prev    next >
Text File  |  1996-08-01  |  1KB  |  51 lines

  1. package URI::URL::wais;
  2. require URI::URL::_generic;
  3. @ISA = qw(URI::URL::_generic);
  4.  
  5. use URI::Escape;
  6.  
  7. # RFC 1738 says:
  8. #
  9. #   A WAIS URL takes one of the following forms:
  10. #
  11. #     wais://<host>:<port>/<database>
  12. #     wais://<host>:<port>/<database>?<search>
  13. #     wais://<host>:<port>/<database>/<wtype>/<wpath>
  14. #
  15. #   where <host> and <port> are as described in Section 3.1. If :<port>
  16. #   is omitted, the port defaults to 210.  The first form designates a
  17. #   WAIS database that is available for searching. The second form
  18. #   designates a particular search.  <database> is the name of the WAIS
  19. #   database being queried.
  20.  
  21.  
  22. sub default_port { 210 }
  23.  
  24. sub _parse {
  25.     my($self, $init) = @_;
  26.     $self->URI::URL::_generic::_parse($init, qw(netloc path query frag));
  27. }
  28.  
  29. # Set the path component with the specified number
  30. sub _path_comp
  31. {
  32.     my $self = shift;
  33.     my $no   = shift;
  34.     my @p = $self->path_components;
  35.     shift(@p) if @p && $p[0] eq '';
  36.     my $old = $p[$no];
  37.     if (@_) {
  38.     $p[$no] = $_[0];
  39.     $self->path_components(@p);
  40.     }
  41.     $old;
  42. }
  43.  
  44. sub database { shift->_path_comp(0, @_); }
  45. sub wtype    { shift->_path_comp(1, @_); }
  46. sub wpath    { shift->_path_comp(2, @_); }
  47.  
  48. *params   = \&URI::URL::bad_method;
  49. *eparams  = \&URI::URL::bad_method;
  50. 1;
  51.