HTML-EP

 view release on metacpan or  search on metacpan

examples/edit.ep  view on Meta::CPAN

    my $show_delete = $cgi->param('show_delete') ? 1 : 0;

    if ($cgi->param('source')) {
	local $/ = undef;
	my $contents;
	my $fh = Symbol::gensym();
	if (!open($fh, "<" . $ENV{'PATH_TRANSLATED'})  ||
	    !defined($contents = <$fh>)  &&  !close($fh)) {
	    die "Error while reading " . $ENV{'PATH_TRANSLATED'} . "$!";
	}
	$self->print("content-type: text/plain\n\n");
	$self->print($contents);
	$self->Stop();
	$self->_ep_exit({});
    }

    my $errors = '';
    my $table = $cgi->param('table');
    my $dbh;
    my $debug = $self->{'debug'};

lib/HTML/EP.pm  view on Meta::CPAN

<BR><BR><BR>
<P>Yours sincerely</P>
</BODY></HTML>
END_OF_HTML
    }

    $template =~ s/\$(\w+)\$/$vars->{$1}/g;
    if ($r) {
        $r->print($self->{'cgi'}->header('-type' => 'text/html'), $template);
    } else {
        print("content-type: text/html\n\n", $template);
	exit 0;
    }
}

sub print ($;@) {
    my $self = shift;
    $self->{_ep_r} ? $self->{_ep_r}->print(@_) : print @_;
}

sub printf {

t/errors.t  view on Meta::CPAN



my $parser = HTML::EP->new();
Test($parser, "Creating the parser.\n");

my $input = <<'END_OF_HTML';
<HTML><ep-error>Something strange happened!</ep-error></HTML>
END_OF_HTML

my $output = <<'END_OF_HTML';
content-type: text/html

<HTML><HEAD><TITLE>Fatal internal error</TITLE></HEAD>
<BODY><H1>Fatal internal error</H1>
<P>An internal error occurred. The error message is:</P>
<PRE>
Something strange happened! at blib/lib/HTML/EP.pm line 7.
.
</PRE>
<P>Please contact the <A HREF="mailto:root@ispsoft.de">Webmaster</A> and tell him URL, time and error message.</P>
<P>We apologize for any inconvenience, please try again later.</P>

t/errors.t  view on Meta::CPAN

END_OF_HTML
Test3($input, $output, "Simple error.\n");

$input = <<'END_OF_HTML';
<HTML>
<ep-errhandler><HTML>Oops: $errmsg$</HTML>
</ep-errhandler><ep-error>So what!</ep-error></HTML>
END_OF_HTML

$output = <<'END_OF_HTML';
content-type: text/html

<HTML>Oops: So what! at blib/lib/HTML/EP.pm line 7.
</HTML>
END_OF_HTML
Test3($input, $output, "Error template.\n");


unlink "foo.ep";



( run in 3.452 seconds using v1.01-cache-2.11-cpan-524268b4103 )