#
# Test for magic and numeric vaiables within HTML::Embperl::Execute
#
# run this under mod_perl / Apache::Registry
#
{
package HTML::Embperl::Test::Tie ;
sub TIESCALAR
{
my ($class, $var) = @_ ;
return bless \$var, $class ;
}
sub FETCH
{
my $self = shift ;
return $$self ;
}
}
use HTML::Embperl ;
my($r) = @_;
$HTML::Embperl::DebugDefault = 811005 ;
$tst1 = '
Here is some text
' ;
$r -> status (200) ;
$r -> send_http_header () ;
print "Test for HTML::Embperl::Execute\n" ;
print " 1.) Include from memory: ref to string
\n" ;
$rc = HTML::Embperl::Execute ({inputfile => 'test_ref_string',
input => \$tst1,
mtime => 1}) ;
print "rc = $rc\n" ;
print "Test for HTML::Embperl::Execute\n" ;
print " 2.) Include from memory: numeric
\n" ;
$rc = HTML::Embperl::Execute ({inputfile => 'test_numeric',
input => 5,
mtime => 1}) ;
print "rc = $rc\n" ;
print "Test for HTML::Embperl::Execute\n" ;
print " 3.) Include from memory: string
\n" ;
$rc = HTML::Embperl::Execute ({inputfile => 'test_string',
input => 'Hi',
mtime => 1}) ;
print "rc = $rc\n" ;
print "Test for HTML::Embperl::Execute\n" ;
print " 4.) Include from memory: array
\n" ;
$rc = HTML::Embperl::Execute ({inputfile => 'test_array',
input => ['a', 'b', 'c'],
mtime => 1}) ;
print "rc = $rc\n" ;
tie $tiedvar1, 'HTML::Embperl::Test::Tie', $tst1 ;
print "Test for HTML::Embperl::Execute\n" ;
print " 5.) Include from memory: tied string ref
\n" ;
$rc = HTML::Embperl::Execute ({inputfile => 'test_tied_string_ref',
input => \$tiedvar1,
mtime => 1}) ;
print "rc = $rc\n" ;
print "Test for HTML::Embperl::Execute\n" ;
print " 6.) Include from memory: tied string
\n" ;
$rc = HTML::Embperl::Execute ({inputfile => 'test_tied_string',
input => $tiedvar1,
mtime => 1}) ;
print "rc = $rc\n" ;
print " 6.) Done :-)
\n" ;
print "\n";