Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re^2: HTML static output

by unixdisk (Initiate)
on Apr 16, 2014 at 07:11 UTC ( [id://1082437]=note: print w/replies, xml ) Need Help??


in reply to Re: HTML static output
in thread HTML static output

I'll repharse my question:Collect system information from unix server like df, ntpq, etc this output is like txt output instead of that need in html output, how to do it?

Replies are listed 'Best First'.
Re^3: HTML static output
by Corion (Patriarch) on Apr 16, 2014 at 07:17 UTC

    The really easy way is to output the text in HTML like the following:

    use HTML::Escape 'escape_html'; my $text= collect_output_as_txt( @servers ); my $title= "Report for servers " . join ",", @servers; $text= escape_html( $text ); print <<HTML; <html> <head><title> $title </title></head> <body> <pre> $text </pre> </body> </html> HTML

    If you want more fancy formatting, you will need to parse the output of each command and then fill the HTML appropriately.

Re^3: HTML static output
by Anonymous Monk on Apr 16, 2014 at 07:27 UTC

    I'll repharse my question:Collect system information from unix server like df, ntpq, etc this output is like txt output instead of that need in html output, how to do it?

    Well ok, that takes care of "save the html" portion, for the rest, my idea, I'd solve the problem the exact same way

    I'd probably use what Corion said in addition to
    HTML::FromText - converts plain text to HTML
    Text::Autoformat - Automatic text wrapping and reformatting

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (10)
As of 2024-04-18 10:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found