perl-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stas Bekman <s...@stason.org>
Subject [Fwd: cvs commit: modperl-docs/src/docs/2.0/user/compat compat.pod]
Date Tue, 29 Jan 2002 09:16:34 GMT
I've committed a doc together with code and it decided to send email to 
docs-cvs list instead of dev-cvs. I guess all the interested parties 
should be on both lists in order not to miss various commits.

-------- Original Message --------
Subject: cvs commit: modperl-docs/src/docs/2.0/user/compat compat.pod
Date: 29 Jan 2002 07:55:56 -0000
From: stas@apache.org
To: modperl-docs-cvs@apache.org

stas        02/01/28 23:55:56

   Modified:    t/response/TestApache compat2.pm
                lib/Apache compat.pm
                src/docs/2.0/user/compat compat.pod
   Log:
   - implement the compat layer for Apache::Util::size_string
   - add tests
   - document the compatibility layer

   Revision  Changes    Path
   1.2       +18 -1     modperl-2.0/t/response/TestApache/compat2.pm

   Index: compat2.pm
   ===================================================================
   RCS file: /home/cvs/modperl-2.0/t/response/TestApache/compat2.pm,v
   retrieving revision 1.1
   retrieving revision 1.2
   diff -u -r1.1 -r1.2
   --- compat2.pm	21 Jan 2002 08:32:46 -0000	1.1
   +++ compat2.pm	29 Jan 2002 07:55:56 -0000	1.2
   @@ -12,10 +12,19 @@
    use Apache::compat ();
    use Apache::Constants qw(OK);

   +my %string_size = (
   +    '-1'            => "    -",
   +    0               => "   0k",
   +    42              => "   1k",
   +    42_000          => "  41k",
   +    42_000_000      => "40.1M",
   +    42_000_000_000  => "40054.3M",
   +);
   +
    sub handler {
        my $r = shift;

   -    plan $r, tests => 28, todo => [23];
   +    plan $r, tests => 34, todo => [23];

        $r->send_http_header('text/plain');

   @@ -144,6 +153,7 @@
                     "\$r->set_content_length($csize) w/ setting 
explicit size");

            $r->set_content_length();
   +        # TODO
            ok t_cmp(0, # XXX: $r->finfo->csize is not available yet
                     $r->headers_out->{"Content-length"},
                     "\$r->set_content_length() w/o setting explicit size");
   @@ -169,6 +179,13 @@
            $r->set_last_modified($time);
            ok t_cmp($time, $r->mtime, "\$r->set_last_modified(\$time)");

   +    }
   +
   +    # Apache::Util::size_string
   +    {
   +        while (my($k, $v) = each %string_size) {
   +            ok t_cmp($v, Apache::Util::size_string($k));
   +        }
        }

        Apache::OK;



   1.33      +27 -0     modperl-2.0/lib/Apache/compat.pm

   Index: compat.pm
   ===================================================================
   RCS file: /home/cvs/modperl-2.0/lib/Apache/compat.pm,v
   retrieving revision 1.32
   retrieving revision 1.33
   diff -u -r1.32 -r1.33
   --- compat.pm	20 Dec 2001 01:31:24 -0000	1.32
   +++ compat.pm	29 Jan 2002 07:55:56 -0000	1.33
   @@ -351,6 +351,33 @@
    # the following functions now live in Apache::RequestRec
    # * mtime

   +package Apache::Util;
   +
   +sub size_string {
   +    my ($size) = shift;
   +
   +    if (!$size) {
   +	$size = "   0k";
   +    }
   +    elsif ($size == -1) {
   +        $size = "    -";
   +    }
   +    elsif ($size < 1024) {
   +	$size = "   1k";
   +    }
   +    elsif ($size < 1048576) {
   +	$size = sprintf "%4dk", ($size + 512) / 1024;
   +    }
   +    elsif (size < 103809024) {
   +	$size = sprintf "%4.1fM", $size / 1048576.0;
   +    }
   +    else {
   +	$size = sprintf "%4dM", ($size + 524288) / 1048576;
   +    }
   +
   +    return $size;
   +
   +}

    1;
    __END__



   1.8       +19 -3     modperl-docs/src/docs/2.0/user/compat/compat.pod

   Index: compat.pod
   ===================================================================
   RCS file: /home/cvs/modperl-docs/src/docs/2.0/user/compat/compat.pod,v
   retrieving revision 1.7
   retrieving revision 1.8
   diff -u -r1.7 -r1.8
   --- compat.pod	22 Jan 2002 16:37:40 -0000	1.7
   +++ compat.pod	29 Jan 2002 07:55:56 -0000	1.8
   @@ -77,17 +77,33 @@

    at the server startup.

   -=head2 gensym
   +=head2 Apache::gensym

    Since Perl 5.6.1 filehandlers are autovivified and there is no need
   -for gensym() function, since now it can be done with:
   +for C<Apache::gensym()> function, since now it can be done with:

      open my $fh, "foo" or die $!;

    The C function modperl_perl_gensym() is available for XS/C extension
    writers, though.

   -=head2 Apache::File
   +=head1 Apache::File
   +
   +
   +
   +
   +=head1 Apache::Util
   +
   +A few C<Apache::Util> functions have changed their interface.
   +
   +=head2 Apache::Util::size_string
   +
   +C<Apache::Util::size_string> has been replaced with
   +C<APR::String::format_size>, which returns formatted strings of only 4
   +characters long. See the C<APR::String> manpage for more information.
   +
   +
   +


    =head1 Miscellaneous




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

-- 


_____________________________________________________________________
Stas Bekman             JAm_pH      --   Just Another mod_perl Hacker
http://stason.org/      mod_perl Guide   http://perl.apache.org/guide
mailto:stas@stason.org  http://ticketmaster.com http://apacheweek.com
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/


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


Mime
View raw message