You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@perl.apache.org by Stas Bekman <st...@stason.org> on 2001/12/06 04:23:06 UTC

more Apache::File compat issues

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


Re: more Apache::File compat issues

Posted by Doug MacEachern <do...@covalent.net>.
On Thu, 6 Dec 2001, Stas Bekman wrote:
 
> in fact this one is the opposite, the syntax in 2.0 is only
> $r->set_last_modified, with no args.

same with the 1.x ap_set_last_modified() function.


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


Re: more Apache::File compat issues

Posted by Stas Bekman <st...@stason.org>.
Stas Bekman wrote:

 > There are a few nits to solve with Apache::File compat:
 >
 > the same here:


in fact this one is the opposite, the syntax in 2.0 is only
$r->set_last_modified, with no args.


 > =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


Re: more Apache::File compat issues

Posted by Doug MacEachern <do...@covalent.net>.
On Fri, 7 Dec 2001, Stas Bekman wrote:
 
> I know, my question was whether we keep the interface exactly as 1.x was 
>   or we change it and let the compat layer to do the work. If we do make 
> it fully compatible, should these adjustments live in File__Apache.h or 
> elsewhere?

yeah, we should support the same interface for these functions.  the only
one that needs a wrapper it set_content_length, which should live in the
wrapper for the module it belongs to, Apache__Response.h

should be able to use the apache_functions.map for the others that just
have default arguments.


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


Re: more Apache::File compat issues

Posted by Stas Bekman <st...@stason.org>.
Doug MacEachern wrote:

> On Thu, 6 Dec 2001, Stas Bekman wrote:
> 
> 
>>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
>>
> ... 
> 
>>The same problem here, in 2.0 you must pass the time argument
>>
>>=item $r->update_mtime()
>>
> ... 
> 
>>=item $r->set_last_modified()
>>
> 
> right, look at the 1.x File.xs, modperl handles this stuff.  so for 2.0
> these function need wrappers in xs/ to handle this.

I know, my question was whether we keep the interface exactly as 1.x was 
  or we change it and let the compat layer to do the work. If we do make 
it fully compatible, should these adjustments live in File__Apache.h or 
elsewhere?


_____________________________________________________________________
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


Re: more Apache::File compat issues

Posted by Doug MacEachern <do...@covalent.net>.
On Thu, 6 Dec 2001, Stas Bekman wrote:

> 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
... 
> The same problem here, in 2.0 you must pass the time argument
> 
> =item $r->update_mtime()
... 
> =item $r->set_last_modified()

right, look at the 1.x File.xs, modperl handles this stuff.  so for 2.0
these function need wrappers in xs/ to handle this.


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