Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re^3: Logfile to HTML and MIME EMail table

by Loops (Chaplain)
on Jul 22, 2013 at 06:28 UTC ( #1045596=note: print w/ replies, xml ) Need Help??


in reply to Re^2: Logfile to HTML and MIME EMail table
in thread Logfile to HTML and MIME EMail table

Remember that the table is being created in HTML so any formatting you can do in HTML you can do in your Perl code. Some email clients don't do a great job with HTML styling, but this is for your own consumption so there's little to worry about there. For instance, if your email client supports CSS (mine doesn't) you can include CSS styles that will change the font for the entire table. If not, you're stuck with setting the individual cell styles or formats.

There are many resources online for HTML, but here are a couple hints for your questions.

# Set background color for alternate rows $table->setRowBGColor($_ * 2, '#9999CC') for (1..12); # Set a border and make it green $table->setStyle('border:4px solid green;');


Comment on Re^3: Logfile to HTML and MIME EMail table
Download Code
Re^4: Logfile to HTML and MIME EMail table
by sidsinha (Acolyte) on Jul 22, 2013 at 07:37 UTC
    Hey Loops! Thankyou , this is a great deal of info for me.it did the job. May sound very basic, but am from a networking domain so very new to perl. Great learning from you! Adios :)
Re^4: Logfile to HTML and MIME EMail table
by sidsinha (Acolyte) on Jul 24, 2013 at 00:37 UTC
    Hi loops, When I use this line below:
    Line 25: $Wtable->addRow(split(/\s\s+/, $Wlog->readline)) for (1..24); +
    it gives me the error while compiling:
    Use of uninitialized value in split at table.pl line 25. Use of uninitialized value in split at table.pl line 25. Use of uninitialized value in split at table.pl line 25.
    This is dependent on the input file? The input file contains:
    Tue Jul 23 14:23:20 2013 17628 KB 4030 KB 77% Tue Jul 23 14:23:20 2013 17628 KB 4030 KB 77% Tue Jul 23 14:23:20 2013 17628 KB 4030 KB 77%
    the split looks ok and the output is fine but somehow this errors come up.
      Yeah, it's complaining because the HTML table expects 7 elements and is only getting 4. I'm sure there is better code to fix this up, but here is a quick fix to ensure that addRow always gets 7 defined elements:
      $Wtable->addRow(map { $_ // "" } (split /\s\s+/, $Wlog->readline)[0 .. + 6]) for (1..24);

      Note that this will mean any lines containing more than 7 elements will be truncated.

      Updated for brain fart
Re^4: Logfile to HTML and MIME EMail table
by Anonymous Monk on Jul 25, 2013 at 19:33 UTC
    Thanyou very much loops.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1045596]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (8)
As of 2014-10-25 14:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (143 votes), past polls