Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I would rather not have to create a temporary html file to do this#!/usr/bin/perl use DBI; use DBIx::XHTML_Table; use MIME::Lite 1.137; $user="sybuser"; $server=SERVER; $pass=nopass; open(DAT,">test.html"); print DAT "<HTML>\n"; print DAT "<BODY>\n"; my $dbh = DBI->connect("dbi:Sybase:server=$server", $user, $pass,{ PrintError => 0, # Don't print + warning messages RaiseError => 1 } ); my $table = DBIx::XHTML_Table->new($dbh); $table->exec_query(" select srvname from master..sysservers where srvid=0 "); $table->modify(td => { style => 'color: black; background: yellow; text-align: +center; border: 1', }); print DAT $table->output({ no_head => 1 }); $table->exec_query(" select SPID,Login,Application,DBName from monProcess where +Login not in (NULL,'probe') "); $table->modify(table => { border => 2, width => '100%', }); $table->modify(th => { style => 'color: black; text-align: center; font-weight: + bold', }); $table->modify(td => { style => 'color: black; background: yellow; text-align: +center; border: none', }); print DAT $table->output({ no_head => 0 }); $dbh->disconnect; print DAT $table->output({ no_head => 0 }); print DAT "\n</BODY>\n"; print DAT "\n</HTML>"; close(DAT); my $msg = MIME::Lite->new(From => 'noname@nohost', To => 'someone@nowhere.com', Subject => 'Report', Type => 'text/html', Path => 'test.html'); $msg->send;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: HTML file or in-memory ?
by bart (Canon) on Dec 15, 2004 at 13:14 UTC | |
by Anonymous Monk on Dec 15, 2004 at 14:28 UTC | |
|
Re: HTML file or in-memory ?
by gellyfish (Monsignor) on Dec 15, 2004 at 13:16 UTC | |
|
Re: HTML file or in-memory ?
by thor (Priest) on Dec 15, 2004 at 13:57 UTC | |
by Anonymous Monk on Dec 15, 2004 at 14:23 UTC | |
by Fletch (Bishop) on Dec 15, 2004 at 15:18 UTC |