Nicolas Bareil > Apache-Description > Apache::Description

Download:
Apache-Description-0.5.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.5   Source  

NAME ^

  Apache::Description - Managing of descriptions in .htaccess

SYNOPSIS ^

List every files/descriptions

  use Apache::Description;

  my $d = Apache::Description->new(".htaccess");

  while ( my ($file, $desc) = $d->next )
    {
      ## is it the last element ?
      last unless $file;

      print "$file : $desc";
    }

Or for the same task :

  use Apache::Description;

  my $d = Apache::Description->new(".htaccess");
  print while $d->next;

Check for the presence of a file

  use Apache::Description;

  my $d = Apache::Description->new(".htaccess");
  if ( $d->ispresent("foo.txt") )
     { print "found\n" }
  else
     { print "not found\n" }

add a description

  use Apache::Description;

  my $d = Apache::Description->new(".htaccess");
  $d->add("foo.txt", "bar bar");

remove the description of foo.txt

  use Apache::Description;

  my $d = Apache::Description->new(".htaccess");
  $d->remove("foo.txt");

get the description of foo.txt

  use Apache::Description;

  my $d = Apache::Description->new(".htaccess");
  my $href = $d->get("foo.txt");

get all filename/description in a hash

  use Apache::Description;

  my $d = Apache::Description->new(".htaccess");
  my $href = $d->getall;

  ## you can access to the description of foo.txt now :
  print qq/foo.txt : $href->{"foo.txt"}\n/;

ABSTRACT ^

 Manage descriptions available in .htaccess with directives like this :
  AddDescription "my description" "my_filename.txt"

DESCRIPTION ^

This module give you access to the AddDescription directives in an object oriented way. Thus, you can add, remove or read descriptions.

CONSTRUCTORS ^

new

If an argument is given to the constructor, it will represent the filename of the .htaccess and the method parse will be called.

METHODS ^

parse( [$filename] )

This function accepts an argument

next

Returns a couple filename/description.

This method can return an array, or a scalar according to the context of the caller.

@array = ($filename, $description)

$scal = qq/$filename:$description/

prev

Returns the previous description in the same format thant next() method.

add( file, description )

Add to the .htaccess a directive AddDescription

remove( file )

Remove a directive from the .htaccess

getall

Returns a reference to a hash of all descriptions where the keys are the filenames.

get( file )

This method returns the description of the file given in argument.

ispresent( $file )

Returns 1 if $file have a description, 0 otherwise.

EXPORT ^

None by default.

SEE ALSO ^

http://www.madchat.org/ - Website with more than 2000 AddDescription directives.

http://httpd.apache.org/

AUTHOR ^

Nicolas Bareil, <nbareil+cpan@mouarf.org>

COPYRIGHT AND LICENSE ^

Copyright 2003 by Nicolas Bareil

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

syntax highlighting: