File: tied.htm

package info (click to toggle)
libembperl-perl 2.5.0-10%2Bdeb9u1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 7,128 kB
  • sloc: ansic: 21,384; perl: 14,496; javascript: 4,280; cpp: 467; xml: 49; makefile: 33; sh: 24
file content (108 lines) | stat: -rwxr-xr-x 2,289 bytes parent folder | download | duplicates (11)
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
#  
# Test for magic and numeric vaiables within Embperl::Execute
#
# run this under mod_perl / Apache::Registry
#

	{
	package Embperl::Test::Tie ;

	sub TIESCALAR
		{
		my ($class, $var) = @_ ;

		return bless \$var, $class ;
		}


	sub FETCH
		{
		my $self = shift ;

		return $$self ;
		}
	}



use Embperl ;

my($r) = @_;

$Embperl::DebugDefault = 811005 ;


$tst1 = '<P>Here is some text</P>' ;

$r -> status (200) ;
$r -> send_http_header () ;

print "<HTML><TITLE>Test for Embperl::Execute</TITLE><BODY>\n" ;
print "<H1> 1.) Include from memory: ref to string</H1>\n" ;

$rc = Embperl::Execute ({inputfile  => 'test_ref_string',
						 input		=> \$tst1,
						 mtime      => 1}) ;

print "\nrc = $rc\n" ;

print "<HTML><TITLE>Test for Embperl::Execute</TITLE><BODY>\n" ;
print "<H1> 2.) Include from memory: numeric</H1>\n" ;

$rc = Embperl::Execute ({inputfile  => 'test_numeric',
						 input		=> 5,
						 mtime      => 1,
						 options    => Embperl::Constant::optReturnError}) ;

print "\nrc = $rc\n" ;

print "<HTML><TITLE>Test for Embperl::Execute</TITLE><BODY>\n" ;
print "<H1> 3.) Include from memory: string</H1>\n" ;

$rc = Embperl::Execute ({inputfile  => 'test_string',
						 input		=> 'Hi',
						 mtime      => 1,
						 options    => Embperl::Constant::optReturnError}) ;


print "\nrc = $rc\n" ;

print "<HTML><TITLE>Test for Embperl::Execute</TITLE><BODY>\n" ;
print "<H1> 4.) Include from memory: array</H1>\n" ;

$rc = Embperl::Execute ({inputfile  => 'test_array',
						 input		=> ['a', 'b', 'c'],
						 mtime      => 1}) ;


print "\nrc = $rc\n" ;

tie $tiedvar1, 'Embperl::Test::Tie', $tst1 ;

print "<HTML><TITLE>Test for Embperl::Execute</TITLE><BODY>\n" ;
print "<H1> 5.) Include from memory: tied string ref</H1>\n" ;

$rc = Embperl::Execute ({inputfile  => 'test_tied_string_ref',
						 input		=> \$tiedvar1,
						 mtime      => 1}) ;


print "\nrc = $rc\n" ;



print "<HTML><TITLE>Test for Embperl::Execute</TITLE><BODY>\n" ;
print "<H1> 6.) Include from memory: tied string</H1>\n" ;

$rc = Embperl::Execute ({inputfile  => 'test_tied_string',
						 input		=> $tiedvar1,
						 mtime      => 1,
						 options    => Embperl::Constant::optReturnError}) ;


print "\nrc = $rc\n" ;

print "<H1> 6.) Done :-)</H1>\n" ;


print "</body></html>\n";