in reply to Re^3: insert CGI script in single quotes.
in thread insert CGI script in single quotes. [SOLVED]

i have parameter content in my modules, and i want to use it in my web page to insert cgi script. the sample of codes like this :

#subroutines sub content; #parameter in modules template my ($self,$content=,) = @_; #scalar placing content my $html = ''; #body content $html .='<div>'; $html .=''.$content.''; $html .='</div>'; #
# i used the parameter in my web content with single quotes .. print MODULES::template->content('XXX'); ..

the XXX is this :

print <<EOF; <thead class="flip-content"> <tr> <th width="20%"> Students id </th> <th class="numeric"> First Name </th> <th class="numeric"> Last Name </th> <th class="numeric"> Date Of Birth </th> <th class="numeric"> Year In </th> <th class="numeric"> Password </th> <th class="numeric"> Email </th> <th class="numeric"> Telepon </th> </tr> </thead> EOF while (my @row_array = $sth->fetchrow_array()) { print <<EOF; <tbody> <tr> <td> $row_array[0] </td> <td> $row_array[1] </td> <td> $row_array[2] </td> <td> $row_array[3] </td> <td> $row_array[4] </td> <td> $row_array[5] </td> <td> $row_array[6] </td> <td> $row_array[7] </td> </tr> </tbody> EOF } print"</table>";

Replies are listed 'Best First'.
Re^5: insert CGI script in single quotes.
by Corion (Patriarch) on Apr 26, 2016 at 18:41 UTC

    Then don't print the table, return it:

    my $result = <<EOF; print <<EOF; <thead class="flip-content"> <tr> <th width="20%"> Students id </th> <th class="numeric"> First Name </th> <th class="numeric"> Last Name </th> <th class="numeric"> Date Of Birth </th> <th class="numeric"> Year In </th> <th class="numeric"> Password </th> <th class="numeric"> Email </th> <th class="numeric"> Telepon </th> </tr> </thead> EOF while (my @row_array = $sth->fetchrow_array()) { $result .= <<EOF; <tbody> <tr> <td> $row_array[0] </td> <td> $row_array[1] </td> <td> $row_array[2] </td> <td> $row_array[3] </td> <td> $row_array[4] </td> <td> $row_array[5] </td> <td> $row_array[6] </td> <td> $row_array[7] </td> </tr> </tbody> EOF } $result .= "</table>"; return $result