Greetings -

My situation is as follows.  I'm trying to write some ASP pages in
PerlScript, 
but for reasons beyond my control, I cannot set the default language to 
PerlScript.  It is set to VBScript.

I have a large initialization block early in the code in
<script></script> 
tags that works fine.  The net result of this block of code is to give
me a 
perl reference to a RecordSet, which I need to iterate and pretty-print
to 
HTML.

I would like to be able to iterate through the RecordSet and print out
all 
of the fields in a nice HTML table.  In the interest of simplicity and 
brevity, the following is an example of some code that I would like to
print 
out one occurrence of the string "Hello, world!" for each row in the
recordSet.

<script language="PerlScript" runat="Server">
        sub helloWorld { return "Hello, World!\n"; }
        while (!$recordSet->EOF) {
</script>
                <%= helloWorld() %>
<script language="PerlScript" runat="Server">
                $recordSet->MoveNext();
        }
</script>

Alas, it prints out "Hello, World!" only once, regardless of the actual
size of
the record set.

As far as I can tell, this is happening because all of the
<script></script>
blocks that are not VBScript are being interpreted and run before
anything else
on the page, including the <%= %> call to helloWorld().

Does anyone know a simple solution to this problem?  Is there an easy
way to
pass a perl reference to a RecordSet object over to VBScript to do the 
iteration?  Is there something I'm missing that will make the above work

as expected, without changing the default language to PerlScript (or
changing
the above code to VBScript.  =P).

Any and all help is appreciated.

-mike

p.s. -- actually, one last question, if you make it this far.  What is
the
preferred method for accessing PerlScript variables in VBScript?  I've
found
that one can make calls to PerlScript subs, but that's a little (read: 
extremely) clunky for just echoing out variables.  I've found that
eval()'ing
works as well (e.g., <%= eval("foo") %> to print out $foo), but that's
non-
intuitive and clunky as well.  I'm sure there must be a better way, but
it has 
so-far eluded me in my google and asdn searches.  thanks.

_______________________________________________
ActivePerl mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/activeperl

Reply via email to