You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl-cvs@perl.apache.org by ch...@locus.apache.org on 2000/02/24 18:03:07 UTC

cvs commit: modperl/Util Util.pm

cholet      00/02/24 09:03:06

  Modified:    .        Changes
               Util     Util.pm
  Log:
  More documentation
  
  Revision  Changes    Path
  1.374     +3 -0      modperl/Changes
  
  Index: Changes
  ===================================================================
  RCS file: /home/cvs/modperl/Changes,v
  retrieving revision 1.373
  retrieving revision 1.374
  diff -u -r1.373 -r1.374
  --- Changes	2000/02/20 14:59:49	1.373
  +++ Changes	2000/02/24 17:03:02	1.374
  @@ -10,6 +10,9 @@
   
   =item 1.21_01-dev
   
  +Apache::Util functions $r->unescape_uri, $r->unescape_uri_info,
  +$r->size_string are now documented [Eric Cholet <ch...@logilune.com>]
  +
   $r->request_time is now documented [Jeffrey W. Baker <jw...@acm.org>]
   
   Look for the makepl_args.mod_perl file as .makepl_args.mod_perl in
  
  
  
  1.7       +33 -0     modperl/Util/Util.pm
  
  Index: Util.pm
  ===================================================================
  RCS file: /home/cvs/modperl/Util/Util.pm,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- Util.pm	1999/02/01 05:39:01	1.6
  +++ Util.pm	2000/02/24 17:03:05	1.7
  @@ -75,6 +75,31 @@
   
    my $esc = Apache::Util::escape_uri($uri);
   
  +=item unescape_uri
  +
  +This function decodes all %XX hex escape sequences in the given URI.
  +
  + my $unescaped = Apache::Util::unescape_uri($safe_uri); 
  +
  +=item unescape_uri_info
  +
  +This function is similar to unescape_uri() but is specialized to remove
  +escape sequences from the query string portion of the URI. The main
  +difference is that it translates the ``+'' character into spaces  as well
  +as recognizing and translating the hex escapes.
  +
  +Example:
  +
  + $string = $r->uri->query;
  + my %data = map { Apache::Util::unescape_uri_info($_) }
  +              split /[=&]/, $string, -1;
  +
  + This would correctly translate the query string
  + ``name=Fred+Flintstone&town=Bedrock'' into the hash: 
  +
  + data => 'Fred Flintstone',
  + town => 'Bedrock'
  +
   =item parsedate
   
   Parses an HTTP date in one of three standard forms:
  @@ -100,6 +125,14 @@
    my $str = Apache::Util::ht_time(time, "%d %b %Y %T %Z");
   
    my $str = Apache::Util::ht_time(time, "%d %b %Y %T %Z", 0);
  +
  +=item size_string
  +
  +Converts the given file size into a formatted string. The size
  +given in the string will be in units of bytes, kilobytes, or
  +megabytes, depending on the size.
  +
  + my $size = Apache::Util::size_string -s $r->finfo;
   
   =back