Apache-SWIT

 view release on metacpan or  search on metacpan

lib/Apache/SWIT.pm  view on Meta::CPAN

use File::Slurp;

our $VERSION = 0.54;

sub swit_startup {}

=head2 $class->swit_send_http_header($r, $ct)

Sends HTTP default headers: session cookie and content type. C<$r> is apache
request and C<$ct> is optional content type (defaults to
C<text/html; charset=utf-8>.

=cut
sub swit_send_http_header {
	my ($class, $r, $ct) = @_;
	$r->pnotes('SWITSession')->end;
	$r->pnotes('SWITSession', undef);
	$r->content_type($ct || "text/html; charset=utf-8");
}

=head2 $class->swit_die($msg, $r, @data_to_dump)

Dies with first line of C<$msg> using Carp::croak and dumps request C<$r> and
C<@data_to_dump> with Data::Dumper into /tmp/swit_<time>.err file.

=cut
sub swit_die {
	my ($class, $msg, $r, @more) = @_;

t/templates/safe.tt  view on Meta::CPAN

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

<html  xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
<form method="post" action="u" enctype="multipart/form-data">
Name: [% name %] <br />
[% SWITCH swit_errors.name %]
[% CASE 'defined' %]
Name cannot be empty
[% CASE 'unique' %]
This name exists already
[% CASE 'custom' %]



( run in 0.314 second using v1.01-cache-2.11-cpan-4d50c553e7e )