Apache2-PageKit
view release on metacpan or search on metacpan
lib/Apache2/PageKit.pm view on Meta::CPAN
}
sub init {}
sub env {
shift->{_r};
}
sub param {
my $self = shift;
my $t = $self->{params_table}
||= $self->{_r}->param || APR::Table::make($self->{_r}->pool, 20);
if ( @_ == 0 ) {
my @keys = ();
$t->do( sub { push @keys, $_[0]; 1 } );
return wantarray ? (@keys) : scalar(@keys);
}
# only one argument
elsif ( @_ == 1 ) {
if (wantarray) {
my @list = $t->get(@_);
return @list;
}
else {
return $t->get(@_);
}
}
# insert something
else {
if ( ref $t eq 'APR::Request::Param::Table' ) {
my $n = APR::Table::make($self->{_r}->pool, 20);
$t->do(sub { $n->set(@_[0..1]) } );
$t = $self->{params_table} = $n;
}
while ( @_ > 0 ) {
my ( $k, $v ) = splice @_, 0, 2;
if ( ref $v eq 'ARRAY' ) {
$t->unset($k);
$t->merge( $k => $v->[$_] ) for ( 0 .. $#$v );
}
elsif ( !defined($v) ) {
$t->unset($k);
}
else {
$t->set( $k => $v );
}
}
}
}
1;
package Apache2::PageKit;
# $Id: PageKit.pm,v 1.236 2004/05/06 09:54:35 borisz Exp $
# require perl 5.8 for numerous utf8 issues ( and Encode )
require 5.008;
use strict;
# CPAN Modules required for pagekit
use mod_perl2 1.9921;
use Apache2::URI ();
use Apache2::Cookie ();
use Apache2::Request ();
use Apache::SessionX ();
use Apache2::Util ();
use Compress::Zlib ();
use File::Find ();
use HTML::FillInForm ();
use HTML::Parser ();
use HTML::Entities ();
use HTML::Template ();
use Encode ();
use XML::LibXML ();
use Apache2::RequestRec ();
use Apache2::RequestIO ();
use Apache2::ServerUtil ();
use Apache2::RequestUtil ();
use Apache2::Util ();
use APR::Date ();
use APR::Request::Param ();
$| = 1;
# PageKit modules
use Apache2::PageKit::Param ();
use Apache2::PageKit::View ();
use Apache2::PageKit::Content ();
use Apache2::PageKit::Model ();
use Apache2::PageKit::Config ();
use Apache2::PageKit::Edit ();
use Apache2::Const qw(OK DONE REDIRECT DECLINED HTTP_NOT_MODIFIED);
use APR::Const -compile => 'SUCCESS';
use vars qw($VERSION);
$VERSION = '2.15';
%Apache2::PageKit::DefaultMediaMap = (
pdf => 'application/pdf',
wml => 'text/vnd.wap.wml',
xml => 'application/xml');
# in httpd.conf file
sub startup {
my ($class, $pkit_root, $server) = @_;
my $s = Apache2::ServerUtil->server;
if ( defined $mod_perl::VERSION && $mod_perl::VERSION >= 1.26 ) {
$pkit_root ||= $s->dir_config('PKIT_ROOT') || die "PKIT_ROOT is not defined! Put PerlSetVar PKIT_ROOT /your/root/path in your httpd.conf";
$server ||= $s->dir_config('PKIT_SERVER') || die "PKIT_SERVER is not defined! Put PerlSetVar PKIT_SERVER servername in your httpd.conf";
} else {
$pkit_root || die 'must specify $pkit_root variable in startup. Usage: Apache2::PageKit->startup($pkit_root, $server)';
$server || die 'must specify $server variable in startup. Usage: Apache2::PageKit->startup($pkit_root, $server)';
( run in 1.174 second using v1.01-cache-2.11-cpan-39bf76dae61 )