Interesting point. I use $data 8 times. Half as a boolean test (no de-reference) and half as a hash reference (to recover one or more values). I guess (and maybe I'm wrong about this) that it doesn't worth the benchmark...
Here is the complete function code:
sub inputBox{
# Don't uncomment, use @_ instead
# my $action_url = shift; # $_[0]
# my $msgid = shift; # $_[1]
# my $action = shift; # $_[2]
my $data = $_[3]; # oh, I needed this one, I wasn't able to use a ha
+sh-slice from a hash-reference in one shot.
<readmore>
return
qq{<form action="$_[0]" method="post">\n}.
($_[1]? qq{ <input type="hidden" name="message_id" value="$_[1]" />\n
+}:'').
qq{ <input type="hidden" name="action" value="$_[2]" />
<input type="hidden" name="commit" value="1" />
<table align="center" border="1" cellpadding="5" cellspacing="0">
<tr valign="middle" align="center" bgcolor="$color{TABLE_HEAD}">
<td colspan="2"> }
.($_[2] eq 'edit'? "Edit Message #$_[1]" : 'Compose New Message' ).
qq{ </td>
</tr>
<tr valign="middle" align="left" >
<td> Author: </td>
<td>
}.( $_[2] eq 'edit'? q{ <input type="text" name="author" size="
+40" }.
( $data? qq{value="$data->{author}"} : &TWiki::Func::getWikiUserName
+() )
. qq{ />} : &TWiki::Func::getWikiUserName() ) . q{
</td>
</tr>
<tr valign="middle" align="left">
<td>Due Date: </td>
<td>} . &gen_date_selector( 'due', ( $data? @$data{'day','month'
+,'year','hour','minute'} : (localtime)[5]+1900, (localtime)[4]+1, (lo
+caltime)[3], 23, 59 ) ) . qq{
</td>
</tr>
<tr valign="middle" align="left">
<td>Message: </td>
<td>
<textarea rows="5" name="msg" cols="50">}.($data? $data->{msg}
+ : '' ).qq{</textarea>
</td>
</tr>
<tr valign="middle" align="left">
<td>
<input type="checkbox" name="dropped" value="Y" }.($data && $d
+ata->{dropped} eq 'Y'? 'CHECKED':'' ).q{> Dropped.
</td>
<td align="right">
<input type="submit" name="change" value="Change Message">
</td>
</tr>
</table>
</form>
};
}