Hey Bal --

> I am trying to put a graph in my application and I am getting 
> the junk on
> the web page insted of the image. I changed the header to 
> image/png via
> $q->header() method still its not working. Can anyone help me 
> with this
> problem. The code for the script is as below.


The problem is, you shouldn't be printing $q->header() to set the header.
(Never, never, ever print() to STDOUT in a CGI Application module!)
Instead, you need to use the header_props() method:


  sub showdetails{
      my $self = shift;
      my $q = $self->query();

      # WRONG: print $q->header( {-type=>'image/png'} );
      # Instead, call this CGI-App method:
      $self->header_props({-type=>'image/png'});

        # showgraph() MUST NOT print()!  It should return data, instead.
      my $graph_binary_data = showgraph();

      # WRONG: print $q->end_html();
      # Instead, return output:
      return $graph_binary_data;
  }


This ought to do it.


TTYL,

-Jesse-

---------------------------------------------------------------------
Web Archive:  http://www.mail-archive.com/[email protected]/
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to