home *** CD-ROM | disk | FTP | other *** search
/ CLIX - Fazer Clix Custa Nix / CLIX-CD.cdr / mac / lib / auto / URI / URL / base.al < prev    next >
Text File  |  1997-12-13  |  746b  |  24 lines

  1. # NOTE: Derived from :lib:URI:URL.pm.  Changes made here will be lost.
  2. package URI::URL;
  3.  
  4. # Access some attributes of a URL object:
  5. sub base {
  6.     my $self = shift;
  7.     return $self->_elem('_base', @_) if @_;      # set
  8.  
  9.     # The base attribute supports 'lazy' conversion from URL strings
  10.     # to URL objects. Strings may be stored but when a string is
  11.     # fetched it will automatically be converted to a URL object.
  12.     # The main benefit is to make it much cheaper to say:
  13.     #   new URI::URL $random_url_string, 'http:'
  14.     my $base = $self->_elem('_base');            # get
  15.     return undef unless defined $base;
  16.     unless (ref $base){
  17.     $base = new URI::URL $base;
  18.     $self->_elem('_base', $base); # set new object
  19.     }
  20.     $base;
  21. }
  22.  
  23. 1;
  24.