Apache-Voodoo

 view release on metacpan or  search on metacpan

META.yml  view on Meta::CPAN

abstract:           or just Voodoo for short; is a web application framework
author:
    - Maverick Edwards <maverick@smurfbane.org>
license:            unknown
distribution_type:  module
configure_requires:
    ExtUtils::MakeMaker:  0
build_requires:
    ExtUtils::MakeMaker:  0
requires:
    Apache2::Cookie:      2.08
    Apache2::Request:     2.08
    Apache::Session:      1.6
    Config::General:      2.27
    CPAN:                 1.9205
    Data::Structure::Util:  0.15
    DBI:                  1.609
    Devel::StackTrace:    1.2
    Digest::MD5:          2.36
    Email::Valid:         0.15
    Exception::Class:     1.26

Makefile.PL  view on Meta::CPAN

	'File::Pid'             => 1.01,
	'HTML::Template'        => 2.7,
	'JSON::DWIW'            => 0.32,
	'Tie::Hash::Indexed'    => 0.05,    # Used by Table/Probe/MySQL.pm
	'Time::HiRes'           => 1.65,
	'XML::Checker'          => 0.13
);

my %optionals = (
	'Apache::Request'  => 1.33,
	'Apache::Cookie'   => 0,
	'Apache2::Request' => 2.08,
	'Apache2::Cookie'  => 2.08,

	'SOAP::Lite'            => 0.710,
	'Data::Structure::Util' => 0.15,

	'Pod::WSDL2'       => 0.06,	# prefer my forked version,
	'Pod::WSDL'        => 0.05,	# fallback to the main one if it's not installed

	'Log::Log4Perl'    => 1.24
);

Makefile.PL  view on Meta::CPAN

	),
	INSTALLSCRIPT => $paths{'SBINDIR'},
	EXE_FILES => ['bin/voodoo-control']
	# PM_FILTER => $filter
);


sub add_mp1 {
	$req = shift;
	$req->{Apache::Request} = $optionals{Apache::Request};
	$req->{Apache::Cookie}  = $optionals{Apache::Cookie};
}

sub add_mp2 {
	$req = shift;
	$req->{Apache2::Request} = $optionals{Apache2::Request};
	$req->{Apache2::Cookie}  = $optionals{Apache2::Cookie};
}

################################################################################
# Copyright (c) 2005 Steven Edwards.  All rights reserved.
################################################################################

lib/Apache/Voodoo/Loader/Dynamic.pm  view on Meta::CPAN

}

sub refresh {
	my $self = shift;

	$self->{'object'} = $self->load_module;
	$self->{'mtime'}  = $self->get_mtime;

	# zap our created closures.
	foreach my $method (keys %{$self->{'provides'}}) {
		# a little help from the Cookbook 10.14
		no strict 'refs';
		no warnings 'redefine';
		*$method = undef;
	}
	$self->{'provides'} = {};
}

#
# Override the built in 'can' to allow:
#   a) trigger dynamically reloading the module as needed

lib/Apache/Voodoo/Loader/Dynamic.pm  view on Meta::CPAN

	elsif ($self->{'object'}->isa("Apache::Voodoo::Zombie") || $self->{'object'}->can($method)) {
		# Either we have a dead module and we map whatever was requested or
		# we have a live one and has the requested method.

		# cache the existance of this method
		$self->{'provides'}->{$method} = 1;

		# If we used the autoloader to get here, then we want to keep using
		# it. Bypass the creation of the closure.
		unless ($nosub) {
			# create a closeure for this method (a little help from the Cookbook 10.14)
			no strict 'refs';
			no warnings 'redefine';
			*$method = sub { my $self = shift; return $self->_handle($method,@_); };
		}
		return 1;
	}

	return 0;
}

lib/Apache/Voodoo/MP/V1.pm  view on Meta::CPAN


$VERSION = "3.0200";

use strict;
use warnings;

use Apache;
use Apache::Constants qw(OK REDIRECT DECLINED FORBIDDEN SERVER_ERROR M_GET);

use Apache::Request;
use Apache::Cookie;

use base("Apache::Voodoo::MP::Common");

sub declined     { return Apache::Constants::DECLINED;     }
sub forbidden    { return Apache::Constants::FORBIDDEN;    }
sub ok           { return Apache::Constants::OK;           }
sub server_error { return Apache::Constants::SERVER_ERROR; }
sub not_found    { return Apache::Constants::NOT_FOUND;    }

sub content_type   { shift()->{'r'}->send_http_header(@_); }

lib/Apache/Voodoo/MP/V1.pm  view on Meta::CPAN

	return \%params;
}

sub set_cookie {
	my $self = shift;

	my $name    = shift;
	my $value   = shift;
	my $expires = shift;

	my $c = Apache::Cookie->new($self->{r},
		-name     => $name,
		-value    => $value,
		-path     => '/',
		-domain   => $self->{'r'}->get_server_name()
	);

	if ($expires) {
		$c->expires($expires);
	}

	# I don't use Apache2::Cookie's bake since it doesn't support setting the HttpOnly flag.
	# The argument goes something like "Not every browser supports it, so what's the point?"
	# Isn't that a bit like saying "What's the point in wearing this bullet proof vest if it
	# doesn't stop a round from a tank?"
	$self->err_header_out('Set-Cookie' => $c->as_string()."; HttpOnly");
}

sub get_cookie {
	my $self = shift;

	unless (defined($self->{cookiejar})) {
		# cookies haven't be parsed yet.
		$self->{cookiejar} = Apache::Cookie::Jar->new($self->{r});
	}

	my $c = $self->{cookiejar}->cookies(shift);
	if (defined($c)) {
		return $c->value;
	}
	else {
		return undef;
	}
}

lib/Apache/Voodoo/MP/V2.pm  view on Meta::CPAN

use Apache2::Const qw(OK REDIRECT DECLINED FORBIDDEN AUTH_REQUIRED SERVER_ERROR NOT_FOUND M_GET);

use Apache2::RequestRec;
use Apache2::RequestIO;
use Apache2::SubRequest;
use Apache2::RequestUtil;
use Apache2::Response;

use Apache2::Request;
use Apache2::Upload;
use Apache2::Cookie;

use base("Apache::Voodoo::MP::Common");

sub declined     { return Apache2::Const::DECLINED;     }
sub forbidden    { return Apache2::Const::FORBIDDEN;    }
sub unauthorized { return Apache2::Const::AUTH_REQUIRED;}
sub ok           { return Apache2::Const::OK;           }
sub server_error { return Apache2::Const::SERVER_ERROR; }
sub not_found    { return Apache2::Const::NOT_FOUND;    }

lib/Apache/Voodoo/MP/V2.pm  view on Meta::CPAN

	return \%params;
}

sub set_cookie {
	my $self = shift;

	my $name    = shift;
	my $value   = shift;
	my $expires = shift;

	my $c = Apache2::Cookie->new($self->{r},
		-name     => $name,
		-value    => $value,
		-path     => '/',
		-domain   => $self->{'r'}->get_server_name()
	);

	if ($expires) {
		$c->expires($expires);
	}

	# I didn't use Apache2::Cookie's bake since it doesn't support setting the HttpOnly flag.
	# The argument setting the flag goes something like "Not every browser supports it,
	# so what's the point?"  Which seems to me to be a bit like saying "What's the point
	# in wearing this bullet proof vest if it doesn't stop a shell from a tank?"
	$self->err_header_out('Set-Cookie' => "$c; HttpOnly");
}

sub get_cookie {
	my $self = shift;

	unless (defined($self->{cookiejar})) {
		# cookies haven't be parsed yet.
		$self->{cookiejar} = Apache2::Cookie::Jar->new($self->{r});
	}

	my $c = $self->{cookiejar}->cookies(shift);
	if (defined($c)) {
		return $c->value;
	}
	else {
		return undef;
	}
}

lib/Apache/Voodoo/Test.pm  view on Meta::CPAN


	my $name    = shift;
	my $value   = shift;
	my $expires = shift;

	$self->{"cookie"}->{$name} = {
		value  => $value,
		domain => $self->remote_host()
	};

	$self->err_header_out('Set-Cookie' => "$name=$value; path=/; domain=".$self->remote_host() ."; HttpOnly");
}

sub get_cookie {
	my $self = shift;
	my $name = shift;

	return $self->{'cookie'}->{$name}->{'value'};
}

1;



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