File: response.asp

package info (click to toggle)
libapache-asp-perl 2.63-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 4,120 kB
  • sloc: perl: 6,044; php: 409; sh: 62; lisp: 22; makefile: 10
file content (125 lines) | stat: -rwxr-xr-x 2,727 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
#!/usr/bin/perl /usr/bin/asp-perl

<!--#include file=header.inc-->

<% 
	my $form = $Request->QueryString();

	# Expires
	$form->{expires} ||= 0;
	$Response->{Expires} = $form->{expires};
	my $update_time = &Apache::ASP::Date::time2str(time()+$form->{expires});

	# Buffer
	(defined $Session->{buffer}) 
		|| ($Session->{buffer} = $Response->{Buffer});
	if($form->{buffer}) {
		$Session->{buffer} = ! $Session->{buffer};
	}
	my $buffer_display = $Session->{buffer} 
		? "Set Buffer Off" : "Set Buffer On";
	$Response->{Buffer} = $Session->{buffer};

	# Cookie
	if($form->{cookie_name}) {
		$Response->{Cookies}{$form->{cookie_name}} = 
			$form->{cookie_value};
	}
%>

<center>
<table border=1 cellpadding=2>
<tr><td colspan=2 align=center><b>Response Object Demonstration</b></td></tr>
<form action=<%=$demo->{file}%> method=GET>
<tr>
	<td colspan=2 align=center>
	<input type=submit name=buffer value="<%=$buffer_display%>">
	<input type=submit name=clear value="Clear Test">
	<input type=submit name=submit value="Submit">
	<td>
</tr>
<tr>
	<td><b>Input Text</b></td>
	<td><input type=text name=text value="<%=$form->{text}%>"></td>
</tr>
<tr>
	<td><b>Expires In (secs)</b></td>
	<td><input type=text name=expires value="<%=$form->{expires}%>"></td>
<% if($update_time) { %>
<tr>
	<td><b>Expires On</b></td>
	<td><%=$update_time%></td>
</tr>
<% } %>
<tr>
	<td><b>Buffering</b></td>
	<td><%=$Response->{Buffer} ? "On" : "Off"%></td>
</tr>
<tr>
	<td><b>Cookie (Name=Value)</b></td>
	<td>
		<input type=text name=cookie_name 
			value="<%=$form->{cookie_name}%>">
		=
		<input type=text name=cookie_value
			value="<%=$form->{cookie_value}%>">
	</td>
</tr>
<tr>
	<td><b>Cookies*</b></td>
	<td>
	<%
	while(my($k, $v) = each %{$Request->Cookies()}) {
		if(ref $v) {
			print "$k:<br>\n";
			for(keys %$v) {
				print "- $v->{$_}=$_<br>\n";
			}				
		} else {
			print "$k=$v\n";
		}
		print "<p>\n";
	}
	%>
	</td>
</tr>

<tr>
	<td><b>Clear Demo</b></td>
	<td>
	<% 
	# printing now aliases to $Response->Write()
	print "
		Here's some text that was added to the box... 
		if you pressed clear and buffering is on,
		you will not see it...
		";

	# demo of $Response->Clear();
	$Response->Flush(); 
	%>
	<!-- inserted text -->
	<table border=1><tr><td>Input Text:<%=$form->{text}%></td></tr></table>
	<%
	if($form->{clear}) {
		$Response->Clear();
	}
	%>
	</td>
</tr>
<tr>
	<td><b>print() demo</b></td>
	<td>
	<% print " perl print() now works! <P>\n"; %>		
	</td>
</tr>

</form>
</table>
</center>
<p>
* Please note that the cookie example takes 2 submits to show up
in the table after setting it because the first time, the header
is sent to the browser, and the 2nd, the browser sends it back.

<!--#include file=footer.inc-->