perl-docs-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject cvs commit: modperl-docs/src/docs/2.0/user/porting compat.pod
Date Tue, 24 Feb 2004 02:22:28 GMT
stas        2004/02/23 18:22:28

  Modified:    src/docs/2.0/api/Apache Util.pod
               src/docs/2.0/user/porting compat.pod
  Log:
  complete the docs for ht_time and its compat friend
  
  Revision  Changes    Path
  1.3       +36 -13    modperl-docs/src/docs/2.0/api/Apache/Util.pod
  
  Index: Util.pod
  ===================================================================
  RCS file: /home/cvs/modperl-docs/src/docs/2.0/api/Apache/Util.pod,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -u -r1.2 -r1.3
  --- Util.pod	14 Jan 2004 23:39:22 -0000	1.2
  +++ Util.pod	24 Feb 2004 02:22:28 -0000	1.3
  @@ -28,31 +28,38 @@
   
   
   
  -=head2 C<format_time>
  +=head2 C<ht_time>
   
  -META: Autogenerated - needs to be reviewed/completed
  +Convert time from an integer value into a string in a specified format
   
  -Convert a time from an integer into a string in a specified format
  -
  -  $time_str = Apache::format_time($time, $fmt, $gmt, $p);
  +  $time_str = Apache::Util::ht_time($p, $time, $fmt, $gmt);
   
   =over 4
   
  -=item arg1: C<$time> (number)
  +=item arg1: C<$p> (C<L<APR::Pool|docs::2.0::api::APR::Pool>>)
  +
  +The pool to allocate memory from
   
  -The time to convert
  +=item arg2 opt: C<$time> (number)
   
  -=item arg2: C<$fmt> (string)
  +The time to convert (e.g., C<time()> or
  +C<L<$r-E<gt>request_time|docs::2.0::api::Apache::RequestRec/C_request_time_>>).
   
  -The format to use for the conversion
  +If the value is not passed the current time will be used.
   
  -=item arg3: C<$gmt> (integer)
  +=item arg3 opt: C<$fmt> (string)
   
  -Convert the time for GMT?
  +The format to use for the conversion, using strftime(3) tokens.
   
  -=item arg4: C<$p> (C<L<APR::Pool|docs::2.0::api::APR::Pool>>)
  +If the value is not passed the default format used is:
   
  -The pool to allocate memory from
  +  "%a, %d %b %Y %H:%M:%S %Z"
  +
  +=item arg4 opt: C<$gmt> (integer)
  +
  +The time will be not converted to GMT if 0 is passed.
  +
  +If the value is not passed 1 (do convert) is used as a default.
   
   =item ret: C<$time_str> (string)
   
  @@ -60,6 +67,22 @@
   
   =back
   
  +Examples:
  +
  +Use current time, the default format and convert to GMT:
  +
  +  $fmtdate = Apache::Util::ht_time($r->pool);
  +
  +Use my time, the default format and convert to GMT:
  +
  +  my $time = time+100;
  +  $fmtdate = Apache::Util::ht_time($r->pool, $time);
  +
  +Use the time the request has started, custom format and don't convert
  +to GMT:
  +
  +  my $fmt = "%a, %D %H:%M:%S %Z";
  +  $fmtdate = Apache::Util::ht_time($r->pool, $r->request_time, $fmt, 0);
   
   
   
  
  
  
  1.42      +15 -5     modperl-docs/src/docs/2.0/user/porting/compat.pod
  
  Index: compat.pod
  ===================================================================
  RCS file: /home/cvs/modperl-docs/src/docs/2.0/user/porting/compat.pod,v
  retrieving revision 1.41
  retrieving revision 1.42
  diff -u -u -r1.41 -r1.42
  --- compat.pod	22 Feb 2004 04:04:32 -0000	1.41
  +++ compat.pod	24 Feb 2004 02:22:28 -0000	1.42
  @@ -1192,18 +1192,28 @@
   
   =head2 C<Apache::Util::ht_time()>
   
  -C<Apache::Util::ht_time()> has been replaced (temporary?) with
  -C<Apache::Util::format_time()>, which requires a pool object as a
  -forth argument. All four arguments are now required.
  +C<Apache::Util::ht_time()> now requires a
  +C<L<pool|docs::2.0::api::APR::Pool>> object as a first argument.
   
   For example:
   
      use Apache::Util ();
      $fmt = '%a, %d %b %Y %H:%M:%S %Z';
      $gmt = 1;
  -   $fmt_time = Apache::Util::format_time(time(), $fmt, $gmt, $r->pool);
  +   $fmt_time = Apache::Util::ht_time($r->pool, time(), $fmt, $gmt);
   
  -See the L<Apache::Util> manpage.
  +See the L<Apache::Util|docs::2.0::api::Apache::Util> manpage.
  +
  +It's also possible to adjust the mod_perl 1.0 code using
  +Apache::compat's
  +L<overriding|docs::2.0::api::Apache::compat/Compatibility_Functions_Colliding_with_mod_perl_2_0_API>.
  +
  +For example:
  +
  +  use Apache::compat;
  +  Apache::compat::override_mp2_api('Apache::Util::ht_time');
  +  $fmt_time = Apache::Util::ht_time(time(), $fmt, $gmt);
  +  Apache::compat::restore_mp2_api('Apache::Util::ht_time');
   
   
   =head2 C<Apache::Util::validate_password()>
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: docs-cvs-unsubscribe@perl.apache.org
For additional commands, e-mail: docs-cvs-help@perl.apache.org


Mime
View raw message