controlling tag output order - mason newbie needs help!

Jason Vas Dias <[email protected]>
Newsgroups gmane.comp.web.mason.devel
Message-ID <[email protected]>
Help / suggestions to solve the following would be greatly appreciated :

I am new to Mason (though not new to PERL!) and cannot understand from
reading the documentation or FAQ why this simple code fragment is  
outputting
the table contents (<TR><TD>..</TD></TR>..)before the enclosing <TABLE>  
...</TABLE> :

----------------------------------------
<HTML>
<BODY>
<p> URI: <% $ENV{'REQUEST_URI'} %>
</p>
<TABLE>
<%perl>
my $k;
foreach $k ( keys %ENV )
{
     print
     '<tr>',
     '<td>', $k,
     '</td>',"\n",
     '<td>=</td>',"\n",
     '<td>',$ENV{$k},
     '</td>', "\n",
     '</tr>',"\n";
};
</%perl>
</TABLE>
</BODY>
</HTML>
----------------------------------------

When served by Apache-eapi-1.3.27 with mod_perl-eapi-1.27
and Mason 1.04 on RedHat Linux 9.0 (Fedora), this produces
the following output (after HTML parsing) - the table
rows and data are output BEFORE the
<p> URI...
</p>
and the enclosing
<TABLE>
</TABLE>
tags, which produces this mess:

----------------------------------------
SCRIPT_NAME = /test_table.html REQUEST_METHOD = GET HTTP_ACCEPT =  
text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/ 
plain;q=0.8,video/x-mng,image/png,image/jpeg,image/gif;q=0.2,*/*;q=0.1  
SCRIPT_FILENAME =  
/home/jason/idealab/find_dotcom/www/htdocs/test_table.html REMOTE_PORT  
= 49701 HTTP_USER_AGENT = Mozilla/5.0 (Macintosh; U; PPC Mac OS X  
Mach-O; en-US; rv:1.4) Gecko/20030624 SERVER_SIGNATURE =  
HTTP_ACCEPT_LANGUAGE = en-us,en;q=0.5 HTTP_SID = CYK-VNVNJ PATH =  
/home/jason/idealab/find_dotcom/bin:/home/jason/idealab/find_dotcom/ 
sbin:/home/jason/idealab/find_dotcom/ext/bin:/home/jason/idealab/ 
find_dotcom/ext/sbin:/usr/kerberos/bin:/usr/local/bin:/usr/bin:/bin:/ 
usr/X11R6/bin:/home/jason/bin GATEWAY_INTERFACE = CGI-Perl/1.1  
SCRIPT_URL = /test_table.html SCRIPT_URI =  
http://jvdsibm:1680:1680/test_table.html HTTP_ACCEPT_CHARSET =  
ISO-8859-1,utf-8;q=0.7,*;q=0.7 SERVER_PORT = 1680 SERVER_PROTOCOL =  
HTTP/1.1 HTTP_SREF = None REQUEST_URI = /test_table.html  
FIND_CLIENT_LOG_LOC = /var/tmp/find_dotcom-jason/find_testcase_logs/  
SERVER_ADDR = 10.1.3.54 HTTP_HOST = jvdsibm:1680 SERVER_SOFTWARE =  
Apache/1.3.27 (Unix) mod_perl/1.27 mod_ssl/2.8.12 OpenSSL/0.9.6g  
QUERY_STRING = HTTP_KEEP_ALIVE = 300 PERL5LIB =  
/home/jason/idealab/find_dotcom/lib/perl5:/home/jason/idealab/ 
find_dotcom/ext/lib/perl5 DOCUMENT_ROOT =  
/home/jason/idealab/find_dotcom/www/htdocs HTTP_UID = VNVNJB9K5P  
SERVER_NAME = jvdsibm:1680 SERVER_ADMIN = [email protected]  
LD_LIBRARY_PATH =  
/home/jason/idealab/find_dotcom/lib:/home/jason/idealab/find_dotcom/ 
ext/lib HTTP_ACCEPT_ENCODING = gzip,deflate HTTP_CONNECTION =  
keep-alive HTTP_PREF = None REMOTE_ADDR = 10.1.3.142 MOD_PERL =  
mod_perl/1.27 HTTP/1.1 200 OK Date: Tue, 27 Apr 2004 21:56:24 GMT  
Server: Apache/1.3.27 (Unix) mod_perl/1.27 mod_ssl/2.8.12  
OpenSSL/0.9.6g NEW_UID: 1 Set-Cookie: finddotcom=VNVNJB9K5P;  
domain=jvdsibm; path=/; expires=Thu, 12-Apr-2007 21:56:24 GMT  
Set-Cookie: FindPermReferer=None; domain=jvdsibm; path=/; expires=Thu,  
12-Apr-2007 21:56:24 GMT NEW_SID: 1 Set-Cookie:  
FindSessionID=CYK-VNVNJ; domain=jvdsibm; path=/ Set-Cookie:  
FindSessionReferer=None; domain=jvdsibm; path=/ Expires: Tue, 27 Apr  
2004 18:56:25 GMT Keep-Alive: timeout=15, max=100 Connection:  
Keep-Alive Transfer-Encoding: chunked Content-Type: text/html 4f

URI: /test_table.html
0
----------------------------------------


How can I get mason to output tags in the order in which they appear in  
a mixed html/mason script file ?

I have used PHP before, and assumed Mason works in a similar way -  
evidently not !

Is there any more detailed documentation that would have explained this  
issue had I found it ?

I have read the mason developer's manual, but can't find any clues to  
resolve the above issue .

Any help / suggestions offered would be greatly appreciated.

Thank You!
Jason Dias.



  



-------------------------------------------------------
This SF.Net email is sponsored by: Oracle 10g
Get certified on the hottest thing ever to hit the market... Oracle 10g. 
Take an Oracle 10g class now, and we'll give you the exam FREE. 
http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.