CPAN-Search-Lite

 view release on metacpan or  search on metacpan

Apache2/Apache2/CPAN/Query.pm  view on Meta::CPAN

use CPAN::Search::Lite::Query;
use CPAN::Search::Lite::Util qw($mode_info $query_info %modes
                                %chaps_rev %chaps $tt2_pages);
our $chaps_desc = {};
our $pages = {};

use CPAN::Search::Lite::Lang qw(%langs load);
use Template;
use File::Spec::Functions qw(catfile catdir);
use Apache2::Request;
use Apache2::Cookie;
use Apache2::RequestRec ();
use Apache2::RequestIO ();
use Apache2::RequestUtil ();
use Apache2::Module ();
use Apache2::Log ();
use APR::Date;
use APR::URI;
use Apache2::URI;
use APR::Const -compile => qw(URI_UNP_OMITQUERY);

Apache2/Apache2/CPAN/Query.pm  view on Meta::CPAN

    }
    my $mirror;
    my $submit = $req->param('submit') || '';
    my $webstart;
    my $lang_cookie;

    if ($submit) {
      $webstart = $req->param('webstart');
      my $value = $webstart || 1;
      my $expires = $webstart ? '+1y' : 'now';
      my $c_ws = Apache2::Cookie->new($r, 
                                           name => $cookie_ws, 
                                           path => '/',
                                           value => $value,
                                           expires => $expires);
      $c_ws->bake($r);
      
      $lang_cookie = $req->param('lang');
      $value = $lang_cookie || 1;
      $expires = $lang_cookie ? '+1y' : 'now';
      my $c_lang = Apache2::Cookie->new($r, 
                                        name => $cookie_lang, 
                                        path => '/',
                                        value => $value,
                                        expires => $expires);
      $c_lang->bake($r);
      $lang = $lang_cookie if $lang_cookie;

      my $host = $req->param('host') || $req->param('url') || '';
      if ($host) {
        my $cookie = Apache2::Cookie->new($r, 
                                          name => $cookie_mirror, 
                                          path => '/',
                                          value => $host,
                                          expires => '+1y');
        $cookie->bake($r);
        $mirror = $host;
      }
    }
    else {
      my %cookies = Apache2::Cookie->fetch($r);
      unless ($mirror) {
        if (my $c = $cookies{$cookie_mirror}) {
          $mirror = $c->value;
        }
      }
      unless ($webstart) {
        if (my $c = $cookies{$cookie_ws}) {
          $webstart = $c->value;
        }
      }

Apache2/Apache2/CPAN/Query.pm  view on Meta::CPAN

__END__

=head1 NAME

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

=head1 DESCRIPTION

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

    PerlLoadModule Apache2::CPAN::Query

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

=over 3

Apache2/Apache2/CPAN/Search.pm  view on Meta::CPAN

use Apache2::Const -compile => qw(OK SERVER_ERROR TAKE1 RSRC_CONF ACCESS_CONF);
use CPAN::Search::Lite::Query;
use CPAN::Search::Lite::Util qw($mode_info $query_info %chaps 
                                %modes $tt2_pages);
our $chaps_desc = {};
our $pages = {};
use CPAN::Search::Lite::Lang qw(%langs load);
use Template;
use File::Spec::Functions qw(catfile catdir);
use Apache2::Request;
use Apache2::Cookie;
use Apache2::RequestRec ();
use Apache2::RequestIO ();
use APR::Date;
use APR::URI;
use Apache2::URI;
use Apache2::Module ();
use Apache2::Log ();
our $VERSION = 0.77;

my @directives = (

Apache2/Apache2/CPAN/Search.pm  view on Meta::CPAN

        if ($r->protocol =~ /(\d\.\d)/ && $1 >= 1.1) {
            $r->headers_out->{'Cache-Control'} = 'max-age=36000';
        }
        else {
            $r->headers_out->{Expires} = APR::Date::parse_http(time+36000);
        }
    }

    my $mirror;
    if (my $host = ($req->param('host') || $req->param('url') )) {
        my $cookie = Apache2::Cookie->new($r, name => $cookie_name,
                                         value => $host, expires => '+1y');
        $cookie->bake;
        $mirror = $host;
   }
    else {
        my %cookies = Apache2::Cookie->fetch($r);
        if (my $c = $cookies{$cookie_name}) {
            $mirror = $c->value; 
        }
    }
    $mirror ||= $dl;
    $r->content_type('text/html; charset=UTF-8');

    my $self = {mode => $mode,
                mirror => $mirror, req => $req, lang => $lang};
    bless $self, $class;

Apache2/Apache2/CPAN/Search.pm  view on Meta::CPAN

__END__

=head1 NAME

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

=head1 DESCRIPTION

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

    PerlLoadModule Apache2::CPAN::Search

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

=over 3

Makefile.PL  view on Meta::CPAN

I can add this to the list of prerequisites, if you like.
END
    my $ans = prompt("Add mod_perl2 to prerequsites?", 'yes');
    $prereqs{'mod_perl2'} = 1.999022 if ($ans =~ /^y/i);
}

eval {require APR::Request;};
if ($@) {
    print <<'END';

Apache2::Request and Apache2::Cookie from the latest libapreq2
distribution (based on Apache 2.0) is required to run part
of the test suite and to use the included Apache handlers
(this is not compatible with Apache::Request and
Apache::Cookie from the libapreq distribution, which is
based on Apache 1.3). See
   http://httpd.apache.org/apreq/
for details on the libapreq2 library, including links
on how to install it.

I can add this to the list of prerequisites, if you like.
END
    my $ans = prompt("Add Apache2::Request to prerequisites?", 'yes');
    $prereqs{'Apache2::Request'} = 0 if ($ans =~ /^y/i);
}

cgi-bin/search  view on Meta::CPAN

#!D:/Perl/bin/perl
use strict;
use CPAN::Search::Lite::Query;
use CPAN::Search::Lite::Util qw($mode_info $query_info %chaps $tt2_pages);
use Template;
use CGI ':standard';
use CGI::Cookie;
use File::Spec::Functions qw(catfile);
my $q = CGI->new();

###############################################################
# Change the following to reflect your setup
my $db = '';                       # name of the database
my $user = '';                     # user to connect as
my $passwd = '';                   # password for this user
my $tt2 = '';                      # tt2 pages
my $max_results = 200;               # maximum results to report

cgi-bin/search  view on Meta::CPAN

                              PRE_PROCESS => ['config', 'header'],
                              POST_PROCESS => 'footer',
                             }) or die Template->error();
my ($results, $page, $query_term, %extra_info, 
    $letter, $age, $mirror, $mode);
my %params = $q->Vars;
my $host = delete $params{host} || delete $params{url};
delete $params{url};

if (defined $host) {
    my $cookie = CGI::Cookie->new(-name => 'cpan_search_mirror',
                                  -value => $host,
                                  -expires => '+1y');
    print $q->header(-cookie => $cookie, -expires => '+2h');
}
else {
    my $expires = ($mode eq 'mirror') ? 'now' : '+2h';
    print $q->header(-expires => $expires);
}
if (not %params) {
    $results = chap_results();
    $page = 'chapterid';
}
else {
    my $query = CPAN::Search::Lite::Query->new(db => $db,
                                               user => $user,
                                               passwd => $passwd,
                                               max_results => $max_results);

    my %cookies = fetch CGI::Cookie;
    unless ($mirror = $host) {
        if ($cookies{cpan_search_mirror}) {
            $mirror = $cookies{cpan_search_mirror}->value;
        }
    }
    $mode = $params{mode};
    my %modes = map {$_ => 1} keys %$mode_info;

    $query_term = trim($params{query});
    $letter = $params{letter};

lib/CPAN/Search/Lite/Lang/de.pm  view on Meta::CPAN

           mirror => 'CPAN mirrors',
           public => '&Ouml;ffentlicher Mirror',
           none => 'Keiner - privaten Mirror nutzen',
           custom => 'Privater Mirror',
           default => 'Der Deafaultlink',
           alt => 'oder',
          install => 'Bringen Sie an',
           mirror1 => << 'END',
Mit dieser Formular k&ouml;nnen Sie einstellen, 
von welchem Mirror Sie Ihre Downloads beziehen wollen. 
Dieses Feature ben&ouml;tigt Cookies. 
Ihre aktuelle Einstellung ist
END
           mirror2 => << 'END',
versucht automatisch, Sie auf einen &ouml;rtlich nahegelegenen 
CPAN Mirror weiterzuleiten.
END
          webstart => << 'END',
Das Vorw&auml;hlen dieser Wahl liefert Verbindungen, 
Ihnen erm&ouml;glichend, CPAN Module und Win32 PPM Pakete 
durch ein Anwendung Verwenden anzubringen



( run in 0.245 second using v1.01-cache-2.11-cpan-e9199f4ba4c )