# # 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 = '

Here is some text

' ; $r -> status (200) ; $r -> send_http_header () ; print "Test for Embperl::Execute\n" ; print "

1.) Include from memory: ref to string

\n" ; $rc = Embperl::Execute ({inputfile => 'test_ref_string', input => \$tst1, mtime => 1}) ; print "\nrc = $rc\n" ; print "Test for Embperl::Execute\n" ; print "

2.) Include from memory: numeric

\n" ; $rc = Embperl::Execute ({inputfile => 'test_numeric', input => 5, mtime => 1, options => Embperl::Constant::optReturnError}) ; print "\nrc = $rc\n" ; print "Test for Embperl::Execute\n" ; print "

3.) Include from memory: string

\n" ; $rc = Embperl::Execute ({inputfile => 'test_string', input => 'Hi', mtime => 1, options => Embperl::Constant::optReturnError}) ; print "\nrc = $rc\n" ; print "Test for Embperl::Execute\n" ; print "

4.) Include from memory: array

\n" ; $rc = Embperl::Execute ({inputfile => 'test_array', input => ['a', 'b', 'c'], mtime => 1}) ; print "\nrc = $rc\n" ; tie $tiedvar1, 'Embperl::Test::Tie', $tst1 ; print "Test for Embperl::Execute\n" ; print "

5.) Include from memory: tied string ref

\n" ; $rc = Embperl::Execute ({inputfile => 'test_tied_string_ref', input => \$tiedvar1, mtime => 1}) ; print "\nrc = $rc\n" ; print "Test for Embperl::Execute\n" ; print "

6.) Include from memory: tied string

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

6.) Done :-)

\n" ; print "\n";