perl-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stas Bekman <s...@stason.org>
Subject more Apache::File compat issues
Date Thu, 06 Dec 2001 03:23:06 GMT
There are a few nits to solve with Apache::File compat:

- $r->set_content_length doesn't support the call without args in 2.0

   From File/File.pm:

=item $r->set_content_length()

This method sets the outgoing Content-length header based on its
argument, which should be expressed in byte units. If no argument is
specified, the method will use the size returned by $r->filename. This
method is a bit faster and more concise than setting Content-length in
the headers_out table yourself.

    $r->set_content_length;
    $r->set_content_length(-s $r->finfo); #same as above
    $r->set_content_length(-s $filename);

-------------------

The same problem here, in 2.0 you must pass the time argument

=item $r->update_mtime()

Rather than setting the request record mtime field directly, you can
use the update_mtime() method to change the value of this field. It
will only be updated if the new time is more recent than the current
mtime. If no time argument is present, the default is the last
modified time of $r->filename.

    $r->update_mtime;
    $r->update_mtime((stat $r->finfo)[9]); #same as above
    $r->update_mtime(time);


-------------------------
the same here:

=item $r->set_last_modified()

This method is used to set the outgoing Last-Modified header from the
value returned by $r->mtime. The method checks that the specified time
is not in the future. In addition, using set_last_modified() is faster
and more concise than setting Last-Modified in the headers_out table
yourself.

You may provide an optional time argument, in which case the method
will first call the update_mtime() to set the file's last modification
date. It will then set the outgoing Last-Modified header as before.

    $r->update_mtime((stat $r->finfo)[9]);
    $r->set_last_modified;
    $r->set_last_modified((stat $r->finfo)[9]); #same as the two lines above


_____________________________________________________________________
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