in reply to < Woes
However, you'd be much better off putting your test in the start tag, evaling that, then skipping to the end tag if the test returns 0. This way you don't have to eval anything except the test.$h_self{form_data}{page} = 'confirmation'; while (<DATA>) { if (m/\<!-- Begin Perl Block --\>/i) { my $perlcode = ''; $perlcode .= $_ while ($_ = <DATA>) && !m/\<!-- End Perl Block + --\>/i; $_ = &{eval $perlcode;}; print; } } __DATA__ <!-- Begin Perl Block --> sub { my $text = ''; if ($h_self{form_data}{page} =~ /confirmation|application/i) { $text = <<OUT; <style type="text/css"> body {font-size: 8pt;font-family: Arial, Helvetica;} table {font-size: 8pt;font-family: Arial, Helvetica;} tr {font-size: 8pt;font-family: Arial, Helvetica;} td {font-size: 8pt;font-family: Arial, Helvetica;} select {font-size: 8pt;font-family: Arial, Helvetica;} input {font-size: 8pt;font-family: Arial, Helvetica;} form {font-size: 8pt;font-family: Arial, Helvetica;} div {font-size: 8pt;font-family: Arial, Helvetica;} p {font-size: 8pt;font-family: Arial, Helvetica;} .red {font-weight: bold;font-size: 10pt;color: red;text-align:right;} .black {font-weight: bold;font-size: 10pt;color: black;text-align:righ +t;} .backfill {background-color:003399;text-align:center;color:white;font- +weight:bold;border: 1px solid white;} .cell {border: 1px solid white;} .edit {width: 50;} </style> OUT # To remove trailing whitespace caused by using <<OUT chomp $text; } return $text; } <!-- End Perl Block -->
|
|---|