NAME

Apache::Htaccess - Create and modify Apache .htaccess files

SYNOPSIS

use Apache::Htaccess;

my $obj = Apache::Htaccess->new("htaccess");
die($Apache::Htaccess::ERROR) if $Apache::Htaccess::ERROR;

$obj->global_requires(@groups);

$obj->add_global_require(@groups);

$obj->directives(CheckSpelling => 'on');

$obj->add_directive(CheckSpelling => 'on');

$obj->requires('admin.cgi',@groups);

$obj->add_require('admin.cgi',@groups);

$obj->save();
die($Apache::Htaccess::ERROR) if $Apache::Htaccess::ERROR;

DESCRIPTION

This module provides an OO interface to Apache .htaccess files. Currently the ability exists to read and write simple htaccess files.

AUTHOR

Matt Cashner <matt@cre8tivegroup.com>

COPYRIGHT

All code is copyright (c) 2000 by The Creative Group. It may be distributed under the terms of Perl itself.

METHODS

new()

my $obj = Apache::Htaccess->new($path_to_htaccess);

Creates a new Htaccess object either with data loaded from an existing htaccess file or from scratch

save()

$obj->save();

Saves the htaccess file to the filename designated at object creation. This method is automatically called on object destruction.

global_requires()

$obj->global_requires(@groups);

Sets the global group requirements. If no params are provided, will return a list of the current groups listed in the global require. Note: as of 0.3, passing this method a parameter list causes the global requires list to be overwritten with your parameters. see add_global_require().

add_global_require()

$obj->add_global_require(@groups);

Sets a global require (or requires) nondestructively. Use this if you just want to add a few global requires without messing with all of the global requires entries.

requires()

$obj->requires($file,@groups);

Sets a group requirement for a file. If no params are given, returns a list of the current groups listed in the files require directive. Note: as of 0.3, passing this method a parameter list causes the requires list to be overwritten with your parameters. see add_require().

add_require()

$obj->add_require($file,@groups);

Sets a require (or requires) nondestructively. Use this if you just want to add a few requires without messing with all of the requires entries.

directives()

$obj->directives(CheckSpelling => 'on');

Sets misc directives not directly supported by the API. If no params are given, returns a list of current directives and their values. Note: as of 0.2, passing this method a parameter list causes the directive list to be overwritten with your parameters. see add_directive().

add_directive()

$obj->add_directive(CheckSpelling => 'on');

Sets a directive (or directives) nondestructively. Use this if you just want to add a few directives without messing with all of the directive entries.

HISTORY

$Log: Htaccess.pm,v $
Revision 1.13  2000/09/29 16:22:46  matt
fixed bug in parser that caused global_reqs to be dumped. ARGH

Revision 1.12  2000/09/29 15:51:04  matt
added global ERROR variable, changed global_require() to global_requires()

Revision 1.11  2000/09/29 15:36:53  matt
think i finally squashed the undef problem with requires()

Revision 1.10  2000/09/29 15:20:36  matt
made global_requires destructive and created add_global_require(), added better error responses to new() and save()

Revision 1.9  2000/09/29 14:31:35  matt
added new methods to the synopsis

Revision 1.8  2000/09/29 14:25:46  matt
made requires nondestructive and added add_require()

Revision 1.7  2000/09/29 12:50:11  matt
made directives() destructive and created the add_directive method()

Revision 1.6  2000/09/27 18:43:23  matt
added more return values. its amazing the little things i forget

Revision 1.5  2000/09/27 18:30:34  matt
fixed silly pod problem

Revision 1.4  2000/09/27 18:23:46  matt
added useful return values to save().

Revision 1.3  2000/09/27 18:19:34  matt
parse now works and can parse htaccess files the module has created (or very similar files). added more docs

Revision 1.2  2000/09/27 14:19:26  matt
deparse now working, additional docs added

Revision 1.1  2000/09/26 21:20:24  matt
first nonfunctional version :)  data structures are set up and accessor methods to those structures are ready. input and output of the file (note: the useful sections) are not yet written.

2 POD Errors

The following errors were encountered while parsing the POD:

Around line 170:

You forgot a '=back' before '=head2'

Around line 397:

=back without =over