home *** CD-ROM | disk | FTP | other *** search
/ CLIX - Fazer Clix Custa Nix / CLIX-CD.cdr / mac / lib / auto / URI / URL / _generic / query.al < prev    next >
Encoding:
Text File  |  1997-06-10  |  739 b   |  29 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 query {
  5.     my $self = shift;
  6.     my $old = $self->_elem('query', map { uri_escape($_, $URI::URL::reserved_no_form) } @_);
  7.     if (defined $old) {
  8.     if ($old =~ /%(?:26|2[bB]|3[dD])/) {  # contains escaped '=' '&' or '+'
  9.         my $mess;
  10.         for ($old) {
  11.         $mess = "Query contains both '+' and '%2B'"
  12.           if /\+/ && /%2[bB]/;
  13.         $mess = "Form query contains escaped '=' or '&'"
  14.           if /=/  && /%(?:3[dD]|26)/;
  15.         }
  16.         if ($mess) {
  17.         Carp::croak("$mess (you must call equery)");
  18.         }
  19.     }
  20.     # Now it should be safe to unescape the string without loosing
  21.     # information
  22.     return uri_unescape($old);
  23.     }
  24.     undef;
  25.  
  26. }
  27.  
  28. 1;
  29.