Debian Codegraph @

test/html/registry/tied.htm

raw
1 #
2 # Test for magic and numeric vaiables within Embperl::Execute
3 #
4 # run this under mod_perl / Apache::Registry
5 #
6
7 {
8 package Embperl::Test::Tie ;
9
10 sub TIESCALAR
11 {
12 my ($class, $var) = @_ ;
13
14 return bless \$var, $class ;
15 }
16
17
18 sub FETCH
19 {
20 my $self = shift ;
21
22 return $$self ;
23 }
24 }
25
26
27
28 use Embperl ;
29
30 my($r) = @_;
31
32 $Embperl::DebugDefault = 811005 ;
33
34
35 $tst1 = '<P>Here is some text</P>' ;
36
37 $r -> status (200) ;
38 $r -> send_http_header () ;
39
40 print "<HTML><TITLE>Test for Embperl::Execute</TITLE><BODY>\n" ;
41 print "<H1> 1.) Include from memory: ref to string</H1>\n" ;
42
43 $rc = Embperl::Execute ({inputfile => 'test_ref_string',
44 input => \$tst1,
45 mtime => 1}) ;
46
47 print "\nrc = $rc\n" ;
48
49 print "<HTML><TITLE>Test for Embperl::Execute</TITLE><BODY>\n" ;
50 print "<H1> 2.) Include from memory: numeric</H1>\n" ;
51
52 $rc = Embperl::Execute ({inputfile => 'test_numeric',
53 input => 5,
54 mtime => 1,
55 options => Embperl::Constant::optReturnError}) ;
56
57 print "\nrc = $rc\n" ;
58
59 print "<HTML><TITLE>Test for Embperl::Execute</TITLE><BODY>\n" ;
60 print "<H1> 3.) Include from memory: string</H1>\n" ;
61
62 $rc = Embperl::Execute ({inputfile => 'test_string',
63 input => 'Hi',
64 mtime => 1,
65 options => Embperl::Constant::optReturnError}) ;
66
67
68 print "\nrc = $rc\n" ;
69
70 print "<HTML><TITLE>Test for Embperl::Execute</TITLE><BODY>\n" ;
71 print "<H1> 4.) Include from memory: array</H1>\n" ;
72
73 $rc = Embperl::Execute ({inputfile => 'test_array',
74 input => ['a', 'b', 'c'],
75 mtime => 1}) ;
76
77
78 print "\nrc = $rc\n" ;
79
80 tie $tiedvar1, 'Embperl::Test::Tie', $tst1 ;
81
82 print "<HTML><TITLE>Test for Embperl::Execute</TITLE><BODY>\n" ;
83 print "<H1> 5.) Include from memory: tied string ref</H1>\n" ;
84
85 $rc = Embperl::Execute ({inputfile => 'test_tied_string_ref',
86 input => \$tiedvar1,
87 mtime => 1}) ;
88
89
90 print "\nrc = $rc\n" ;
91
92
93
94 print "<HTML><TITLE>Test for Embperl::Execute</TITLE><BODY>\n" ;
95 print "<H1> 6.) Include from memory: tied string</H1>\n" ;
96
97 $rc = Embperl::Execute ({inputfile => 'test_tied_string',
98 input => $tiedvar1,
99 mtime => 1,
100 options => Embperl::Constant::optReturnError}) ;
101
102
103 print "\nrc = $rc\n" ;
104
105 print "<H1> 6.) Done :-)</H1>\n" ;
106
107
108 print "</body></html>\n";