Skip to content

Commit

Permalink
inject request handler for testing purpose
Browse files Browse the repository at this point in the history
  • Loading branch information
dann committed Jan 31, 2009
1 parent 31ccaeb commit b48df7c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
6 changes: 5 additions & 1 deletion angelos-core/lib/Angelos.pm
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ has 'debug' => (
default => 0
);

has 'request_handler' => ( is => 'rw', );

sub setup {
my $self = shift;
my $bootloader = Angelos::BootLoader->new(
Expand All @@ -39,6 +41,8 @@ sub setup {
debug => $self->debug,
);
my $engine = $bootloader->run;
$engine->request_handler( $self->request_handler )
if $self->request_handler;
$self->engine($engine);
}

Expand All @@ -48,12 +52,12 @@ sub run {
}

our $MIMETYPES;

sub available_mimetypes {
$MIMETYPES = Angelos::MIMETypes->new;
$MIMETYPES;
}


__END_OF_CLASS__

__END__
Expand Down
14 changes: 10 additions & 4 deletions angelos-core/lib/Angelos/Engine/Base.pm
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ has 'root' => (
);

has 'host' => (
is => 'rw',
isa => 'Str',
default => '127.0.0.1',
is => 'rw',
isa => 'Str',
default => '127.0.0.1',
);

has 'port' => (
Expand All @@ -42,6 +42,11 @@ has 'debug' => (
default => 0
);

has 'request_handler' => (
is => 'rw',
isa => 'CodeRef',
);

sub BUILD {
my $self = shift;
$self->engine( $self->build_engine );
Expand All @@ -51,7 +56,8 @@ sub SETUP { }

sub build_engine {
my $self = shift;
my $request_handler = $self->build_request_handler;
my $request_handler = $self->request_handler;
$request_handler ||= $self->build_request_handler;

return HTTP::Engine->new(
interface => {
Expand Down

0 comments on commit b48df7c

Please sign in to comment.