mod_perl logo perl icon
previous page: Apache::Table - Perl interface to the Apache table structurepage up: mod_perl 1.0 APInext page: Apache::Log - Interface to Apache logging

Apache::File - advanced functions for manipulating files at the server side






Practical mod_perl

Practical mod_perl

By Stas Bekman, Eric Cholet
The mod_perl Developer's Cookbook

The mod_perl Developer's Cookbook

By Geoffrey Young, Paul Lindner, Randy Kobes
mod_perl Pocket Reference

mod_perl Pocket Reference

By Andrew Ford
Writing Apache Modules with Perl and C

Writing Apache Modules with Perl and C

By Lincoln Stein, Doug MacEachern
Embedding Perl in HTML with Mason

Embedding Perl in HTML with Mason

By Dave Rolsky, Ken Williams
mod_perl2 User's Guide

mod_perl2 User's Guide

By Stas Bekman, Jim Brandt


Table of Contents

Synopsis

   use Apache::File ();
   
   my $fh = Apache::File->new($filename);
   print $fh 'Hello';
   $fh->close;
   
   my ($name, $fh) = Apache::File->tmpfile;
   
   if ((my $rc = $r->discard_request_body) != OK) {
      return $rc;
   }
   
   if((my $rc = $r->meets_conditions) != OK) {
      return $rc;
   }
   
   my $date_string = localtime $r->mtime;
   
   $r->set_content_length;
   $r->set_etag;
   $r->update_mtime;
   $r->set_last_modified;


TOP

Description

Apache::File does two things: it provides an object-oriented interface to filehandles similar to Perl's standard IO::File class. While the Apache::File module does not provide all the functionality of IO::File, its methods are approximately twice as fast as the equivalent IO::File methods. Secondly, when you use Apache::File, it adds several new methods to the Apache class which provide support for handling files under the HTTP/1.1 protocol.



TOP

Apache::File methods



TOP

Apache Methods added by Apache::File

When a handler pulls in Apache::File, the module adds a number of new methods to the Apache request object. These methods are generally of interest to handlers that wish to serve static files from disk or memory using the features of the HTTP/1.1 protocol that provide increased performance through client-side document caching.



TOP

Maintainers

Maintainer is the person(s) you should contact with updates, corrections and patches.



TOP

Authors

Only the major authors are listed above. For contributors see the Changes file.






TOP
previous page: Apache::Table - Perl interface to the Apache table structurepage up: mod_perl 1.0 APInext page: Apache::Log - Interface to Apache logging