perl-embperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kee Hinckley <>
Subject Passing html to a function from within an HTML file.
Date Sat, 17 Aug 2002 20:54:28 GMT
I'm flumuxed.

Here's a function that takes either a label and some html, or a 
label, a hashref and a name.  It outputs a table row.

$ sub ShowRow $]
     [# label html  OR label hashref name #]
     <tr valign=top>
         <td>[+ $_[1] +]:</td>
             [$ if (UNIVERSAL::isa($_[2], 'HASH') || 
substr("$_[2]",0,1) eq '*') $]
                 [+ $_[2]->{$_[3]} +]
             [$ else $]
                 [- do {local($escmode) = 4; print OUT $_[2]; } -]
             [$ endif $]
[$ endsub $]

Here's a call in the hashref form
[- $this->ShowRow('UserID', $user, 'userid') -]
Works fine.

Here are two calls in the HTML form
     [- $this->ShowRow('Name',
         "$fdat{prefix} $fdat{fname} $fdat{mname} $fdat{lname} 
$fdat{suffix}") -]
     [- $this->ShowRow('Address',
         "$fdat{addr1}<br>$fdat{addr2}<br>$fdat{city}, $fdat{state} 
$fdat{postalcode}") -]

In the latter case all the HTML tags disappear.  If I use &lt; and 
&gt; instead of < and > they work fine.  $escmode is set to 7.

Is there any way to make this work (without resetting escmode before 
each call to the function--not that I can get that to work either

Kee Hinckley - Somewhere.Com, LLC

I'm not sure which upsets me more: that people are so unwilling to accept
responsibility for their own actions, or that they are so eager to regulate
everyone else's.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message