Hopkins-Plugin-HMI

 view release on metacpan or  search on metacpan

lib/Hopkins/Plugin/HMI.pm  view on Meta::CPAN

		my $template	= new Template;
		my $stash		= { errors => \@err, version => $Hopkins::Plugin::HMI::VERSION };
		my $output		= '';

		$template->process(\$self->errmsg, $stash, \$output);

		$res->content($output);
		$res->code(500);

		return RC_OK;
	}

	# if the content we get back from is an IO::File object,
	# flatten it by reading it in and spitting it back out.

	if (UNIVERSAL::isa($obj->content, 'IO::File')) {
		my $content;

		while (not eof $obj->content) {
			read $obj->content, my ($buf), 64 * 1024;
			$content .= $buf;
		}

		$obj->content($content);
	}

	# Catalyst::Engine::Embeddable->handle_request populates
	# a HTTP::Response object, though PoCo::Server::HTTP has
	# already provided us with one.  transcribe the contents
	# of the catalyst HTTP::Response onto the other instance
	# provided by POE::Component::Server::HTTP.

	$res->header($_ => $obj->header($_))
		foreach $obj->headers->header_field_names;

	$res->code($obj->code);
	$res->content($obj->content);
	$res->message('');

	$req->header(Connection => 'close');

	return RC_OK;
}

=back

=head1 AUTHOR

Mike Eldridge <diz@cpan.org>

=head1 LICENSE

This program is free software; you may redistribute it
and/or modify it under the same terms as Perl itself.

=cut

1;

__DATA__
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
	<head>
		<title>hopkins HMI - error</title>
		<style type="text/css">
			body
			{
				background-color:	#393939;
				font-family:		Tahoma, Arial, Helvetica, sans-serif;
			}

			div
			{
				width:				800px;
				margin:				auto;
				margin-top:			100px;
			}

			div div
			{
				width:				auto;
				margin:				0;
				padding:			20px;
				border:				1px solid #411;
				background-color:	#911;
			}

			h1
			{
				color:				#fff;
				font-size:			2em;
				font-weight:		normal;
				border-bottom:		2px dotted #f88;
				padding-bottom:		10px;
				margin:				0 0 0 0;
			}

			div p
			{
				color:				#ddd;
			}

			span
			{
				color:				#aaa;
				font-size:			0.6em;
				float:				right;
			}
		</style>
	</head>

	<body>
		<div>
			<div>
				<h1>Internal Server Error</h1>

				[% FOREACH error = errors %]
					<p>
						[% error %]



( run in 2.190 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )