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

Re^2: using CGI to output a system command

by drock (Beadle)
on Aug 03, 2005 at 17:42 UTC ( #480579=note: print w/replies, xml ) Need Help??

in reply to Re: using CGI to output a system command
in thread using CGI to output a system command

ok people, I was able to get what I needed using OO CGI. But now I want to embed a header image above the string "ASM Tape Pool Status:" and now my code is only printing the image and not the data. Any ideas? thank you, derek
#!/usr/bin/perl use strict; use warnings; use CGI; #use GD; $ENV{"PATH"} = qq(/opt/SUNWsamfs/sbin:/usr/bin); #sub image #{ my $imgtype = qw(gif); my $imgpath = qq(/var/apache/htdocs/images/logo.gif); # open (IMAGE, $imgpath) or die $!; # print "Pragma: no-cache\n"; # print "Content-type: image/$imgtype\n\n"; # # while (read(IMAGE, my $buffer, 16_384) ) # { # print $buffer; # } # # close (IMAGE); #} my $q1 =new CGI; print $q1->header( -type => "image/gif"); while (read(IMAGE, my $buffer, 16_384) ) { print $buffer; my $q =new CGI; print $q->header, $q->start_html('OHIS ASM server: stkv440'), + # Header $q->h1({-style=>'Color:blue'},'ASM Tape Pool Status:'), + # Body open (ARC, "archiver -lv |") or die $!; my $flag=0; while (<ARC>) { if (/(?i)allsets/) { $flag=1; } if ($flag==1) { if (/(?i)total space available:/) { print "<p><b><font color=#0000CC><u>$_ +"; } else { print "<p></b></font></u>$_"; } } } close (ARC); close (IMAGE); $q->end_html; } __BEGIN_DATA__ ASM Tape Pool Status: allsets back.1 media: sf Volumes: STK000 Total space available: 58.8G back.2 media: sf Volumes: STK005 Total space available: 58.8G clinical1.1

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (5)
As of 2023-06-01 12:34 GMT
Find Nodes?
    Voting Booth?

    No recent polls found