Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^2: Logfile to HTML and MIME EMail table

by sidsinha (Acolyte)
on Jul 22, 2013 at 05:42 UTC ( #1045589=note: print w/ replies, xml ) Need Help??


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

Two More questions: Is it possible to have alternating row colors (i read a documentation where we can define evenrowclass and oddrowclass while defining a table using HTML::Table. But it doesnt say how to define a class. -evenrowclass=>'even', -oddrowclass=>'odd', 2. Is it possible to change the font face of the table? or we have to specifically give col/row wise font as below:

$table->setColFormat(1, '<font color="red" face="Calibri">', '</font>' +);
Is it possible to have borders for the table? I mean say black border color. I could only find spacing option and border (0/1). Thanks!!!


Comment on Re^2: Logfile to HTML and MIME EMail table
Download Code
Re^3: Logfile to HTML and MIME EMail table
by Loops (Hermit) on Jul 22, 2013 at 06:28 UTC

    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;');
      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 :)
      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
      Thanyou very much loops.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (6)
As of 2014-08-22 00:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (144 votes), past polls