You are viewing a plain text version of this content. The canonical link for it is here.
Posted to embperl@perl.apache.org by wo...@basf-ag.de on 2002/07/17 13:44:32 UTC

Display GD graphics with embperl

Hello.

I will visualize some data with the gd::graph module. How can i display the
graphics
on the fly with embperl.
The statement below doesn't work because of missing binmode
$rec_req->content_type('image/png');
binmode STDOUT;
print STDOUT $req->{image}->plot(\@data)->png();

This is the error message:
[22445]ERR: 24: Error in Perl code: Can't locate object method "BINMODE"
via package "Apache::RequestRec" (perhaps you forgot to load
"Apache::RequestRec"?) a

I use modperl.v2, embperl.v2 and apache.v2

Wolfgang
------------------------------------------------------------------------
Wolfgang Leideck
ONSYS GmbH
Fon: +49 (0)621/60-44104
Fax: +49 (0)621/60-73744
E-Mail: Wolfgang.Leideck@onsys.de



---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org


Re: Display GD graphics with embperl

Posted by Jochen Topf <jo...@remote.org>.
On Wed, Jul 17, 2002 at 01:44:32PM +0200, wolfgang--onsys.leideck@basf-ag.de wrote:
> I will visualize some data with the gd::graph module. How can i display the
> graphics
> on the fly with embperl.
> The statement below doesn't work because of missing binmode
> $rec_req->content_type('image/png');
> binmode STDOUT;

You don't need binmode() on Unix systems. And you probably want to output
to OUT not STDOUT in Emperl.

> print STDOUT $req->{image}->plot(\@data)->png();
> 
> This is the error message:
> [22445]ERR: 24: Error in Perl code: Can't locate object method "BINMODE"
> via package "Apache::RequestRec" (perhaps you forgot to load
> "Apache::RequestRec"?) a

Jochen
-- 
Jochen Topf  jochen@remote.org  http://www.remote.org/jochen/  +49-721-388298


---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org


Re: Display GD graphics with embperl

Posted by Gerald Richter <ri...@ecos.de>.
Hi,

> $rec_req->content_type('image/png');
> binmode STDOUT;
> print STDOUT $req->{image}->plot(\@data)->png();
>

As others already pointed out, you need to print to OUT instead of STDOUT,
otherwise the content will be send before the http headers and the browser
will not see the content-type header. Additionaly you have to set $escmode
to zero. There is no need for the binmode. Make sure you have no addtionaly
spaces in the file, othwise they will also send to the browser.

[-
$escmode = 0 ;
$rec_req->content_type('image/png');
print OUT $req->{image}->plot(\@data)->png();
-]

Gerald

-------------------------------------------------------------
Gerald Richter    ecos electronic communication services gmbh
Internetconnect * Webserver/-design/-datenbanken * Consulting

Post:       Tulpenstrasse 5         D-55276 Dienheim b. Mainz
E-Mail:     richter@ecos.de         Voice:    +49 6133 925131
WWW:        http://www.ecos.de      Fax:      +49 6133 925152
-------------------------------------------------------------


---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org


Re: Display GD graphics with embperl

Posted by Aaron Johnson <so...@gina.net>.
What apache directive are you using to tell apache how to deliver the
Embperl files and the png files?  I know Apache::ASP suffers from greedy
processing if you use too loose of a directive, maybe something similar
is happening with Embperl.

Aaron

On Wed, 2002-07-17 at 07:44, wolfgang--onsys.leideck@basf-ag.de wrote:
> 
> Hello.
> 
> I will visualize some data with the gd::graph module. How can i display the
> graphics
> on the fly with embperl.
> The statement below doesn't work because of missing binmode
> $rec_req->content_type('image/png');
> binmode STDOUT;
> print STDOUT $req->{image}->plot(\@data)->png();
> 
> This is the error message:
> [22445]ERR: 24: Error in Perl code: Can't locate object method "BINMODE"
> via package "Apache::RequestRec" (perhaps you forgot to load
> "Apache::RequestRec"?) a
> 
> I use modperl.v2, embperl.v2 and apache.v2
> 
> Wolfgang
> ------------------------------------------------------------------------
> Wolfgang Leideck
> ONSYS GmbH
> Fon: +49 (0)621/60-44104
> Fax: +49 (0)621/60-73744
> E-Mail: Wolfgang.Leideck@onsys.de
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
> For additional commands, e-mail: embperl-help@perl.apache.org
> 
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org