Hi Monks!
I have a sample code here to support my question which is about hiding the html that I will need later in my code to send it by email. I would like to hide the html portion of the code because I also need to run this code from the command line. Is there a way to hide the html part of a Perl code, hide it from view, but still process the html code as well and just show the command line format view of it? I hope I made myself clear.
Here is the code sample I mentioned :
#!/usr/bin/perl -w
use strict;
use CGI qw(-oldstyle_urls :standard);
use CGI::Carp qw(fatalsToBrowser);
use Date::Calc qw( Add_Delta_Days Decode_Date_US Today );
my $q = new CGI;
my @todays;
@todays = Today() unless ($ARGV[0] && (@todays = Decode_Date_US( $A
+RGV[0] )));
my $page = "\n\n";
#my $page = "<br><br>";
# yesterday's date
my @yesterday = Add_Delta_Days( @todays, -1 );
my $forms = " %-16s %-22s %-15s %-5s %s\n";
#my $forms = " %-16s %-22s %-15s %-5s %s<br>";
my $t_string = sprintf "%04d-%02d-%02d", @todays;
my $y_string = sprintf "%04d-%02d-%02d", @yesterday;
=code
$page .= "<table width=\"100%\" border=\"0\" bgcolor=\"#ffffff\" cell
+padding=\"0\" cellspacing=\"0\">
<tr>
<td width=\"60%\">Date Format Sample:</td>
<td width=\"40%\" align=\"left\"><b>$y_string</b></t
+d>
</tr>
<tr>
<td width=\"100%\" colspan=\"2\"> </td>
</tr>
</table>";
=cut
$page .= sprintf $forms, "TODAY", "YESTERDAY";
$page .= " ----------------------------------------------------------
+--------------\n";
$page .= " ----------$t_string - $y_string-----------\n";
print $page;
Thanks for looking!
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.