NAME

Apache::CPAN::Query - mod_perl interface to CPAN::Search::Lite::Query

DESCRIPTION

This module provides a mod_perl (2) interface to CPAN::Search::Lite::Query. The modules Apache::Request and Apache::Cookie of the libapreq2 distribution are required. A directive

PerlLoadModule Apache::CPAN::Query

should appear before any of the Location directives using the module. As well, the following directives should be defined in the Apache configuration file.

CSL_db database

the name of the database [required]

CSL_user user

the user to connect to the database as [required]

CSL_passwd password

the password to use for this user [required]

CSL_tt2 /path/to/tt2

the path to the tt2 pages [required]

CSL_dl http://www.cpan.org

the default download location [optional - http://www.cpan.org will be used if not specified]

CSL_max_results 200

the maximum number of results to obtain [optional - 200 will be used if not specified]

CSL_html_root /usr/local/httpd/CPAN

the path to the local html docs [required for the perldoc handler]

CSL_html_uri http://you.org/CPAN/docs

the uri to use for the html docs [required for the perldoc handler]

Available response handlers are as follows.

  • search

    <Location "/search">
      SetHandler perl-script
      PerlResponseHandler Apache::CPAN::Query->search
    </Location>

    This handles search queries such as for http://localhost/search?mode=dist;query=libnet. mode can be one of dist, module, or author. A search using the specified query will be done on, respectively, distribution names and abstracts, module names and abstracts, and CPAN ids and full names.

  • cpanid

    <LocationMatch "/~[A-Za-z-]+">
      SetHandler perl-script
      PerlResponseHandler Apache::CPAN::Query->cpanid
    </LocationMatch>

    There are two levels:

    • http://localhost/~cpanid

      This will bring up a page of information on the author whose cpanid is CPANID.

    • http://localhost/~cpanid/Dist-Name

      This will bring up a page of information on the distribution Dist-Name of cpanid CPANID.

  • author

    <Location "/author">
      SetHandler perl-script
      PerlResponseHandler Apache::CPAN::Query->author
    </Location>

    There are 3 levels:

    • http://localhost/author

      This brings up a menu of letters of the alphabet to link to authors whose ids begin with that letter.

    • http://localhost/author/CPANID

      This brings up an information page for the author with cpanid CPANID.

    • http://localhost/author/A/

      This brings up a list of all authors whose cpanids begin with A.

  • dist

    <Location "/dist">
      SetHandler perl-script
      PerlResponseHandler Apache::CPAN::Query->dist
    </Location>

    There are 4 levels:

    • http://localhost/dist

      This brings up a menu of letters of the alphabet to link to distributions whose names begin with that letter.

    • http://localhost/dist/Dist-Name

      This brings up an information page for the distribution with name Dist-Name.

    • http://localhost/dist/A/

      This brings up a list of all distributions whose names begin with A.

    • http://localhost/dist/ABC/

      This brings up a list of all distributions whose names match ABC-*.

  • module

    <Location "/module">
      SetHandler perl-script
      PerlResponseHandler Apache::CPAN::Query->module
    </Location>

    There are 4 levels:

    • http://localhost/module

      This brings up a menu of letters of the alphabet to link to mocules whose names begin with that letter.

    • http://localhost/module/Mod::Name

      This brings up an information page for the module with name Mod::Name.

    • http://localhost/module/A/

      This brings up a list of all modules whose names begin with A.

    • http://localhost/module/ABC/

      This brings up a list of all modules whose names match ABC::*.

  • chapter

    <Location "/chapter">
      SetHandler perl-script
      PerlResponseHandler Apache::CPAN::Query->chapter
    </Location>

    There are 3 levels:

    • http://localhost/chapter

      This brings up a menu of all available chapter headings (as appears in %chaps of CPAN::Search::Lite::Util).

    • http://localhost/chapter/Data_Type_Utilities

      This brings up a list all subchapters of the Data Type Utilities chapter.

    • http://localhost/chapter/Data_Type_Utilities/Tie

      This brings up a list of all distributions in the Tie subchapter of the Data Type Utilities chapter.

  • recent

    <Location "/recent">
      SetHandler perl-script
      PerlResponseHandler Apache::CPAN::Query->recent
    </Location>

    With this, a request for http://localhost/recent will list all distributions uploaded in the last 7 days.

  • mirror

    <Location "/mirror">
      SetHandler perl-script
      PerlResponseHandler Apache::CPAN::Query->mirror
    </Location>

    With this, a request for http://localhost/mirror will bring up a page whereby the user can change the location of where downloads will be redirected to. This requires cookies to be enabled.

  • perldoc

    <Location "/perldoc">
      SetHandler perl-script
      PerlResponseHandler Apache::CPAN::Query->perldoc
    </Location>

    With this, a request for, eg, http://localhost/perldoc/perlfaq will be redirected to the perfaq documentation, and a request for, eg, http://localhost/perldoc/Net::FTP, will be redirected to the documentation for Net::FTP.

SEE ALSO

Apache::CPAN::Search, CPAN::Search::Lite::Query, and mod_perl.