You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Chris Drake <ch...@pobox.com> on 2004/01/24 03:05:53 UTC

GIF contents not "coming out"

Hi All,

My mod_perl 2 script is not sending back the contents of the GIF I'm
trying to print.  Running it locally, it does, or if I go:-
print "foo";
... I get "foo" - but when I print the GIF - I just get back the
headers without any content!!!

HELP!

--------------------------------------------------------------

#!/usr/bin/perl

use Chris;
use bytes;

{
  $::r=shift;
  use strict;

  print "Content-type: image/gif\n"; print "\n";

  my($icon)='favicon_2.ico';
  if(open(GIF,"<$::WebPath/$icon")) {
    my @gif=<GIF>;
    $::r->print( @gif ); #warn @gif;
    close(GIF);
  } else {
    warn "Could not open $::WebPath/$icon - $!";
  }
  $::r->print("foo\n");  # Nothing comes back
}


--------------------------------------------------------------

[cnd]$ curl -i http://www.example.com/foo.asp
HTTP/1.1 200 OK
Date: Sat, 24 Jan 2004 01:57:18 GMT
Server: Apache
Transfer-Encoding: chunked
Content-Type: image/gif

[cnd]$

--------------------------------------------------------------

==> /var/log/httpd/access_log <==
2004-01-24 01:57:18   200    "GET /foo.asp HTTP/1.1"
 "curl/7.10.1 (i686-pc-linux-gnu) libcurl 7.9.8 (OpenSSL 0.9.6) (ipv6 enabled)"
  -image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*        -       4919



--------------------------------------------------------------

If I comment out the line "$::r->print( @gif );", I get this though!:-

[cnd]$ curl -i http://www.example.com/foo.asp
HTTP/1.1 200 OK
Date: Sat, 24 Jan 2004 01:59:55 GMT
Server: Apache
Transfer-Encoding: chunked
Content-Type: image/gif

foo
[cnd]$

--------------------------------------------------------------
What's UP?  Is this a bug or something??

I'm using RedHet Enterprise 3
Apache/2.0.46 (Red Hat)
/usr/lib/perl5/vendor_perl/5.8.0/i386-linux-thread-multi/ModPerl/Registry.pm
/usr/share/doc/mod_perl-1.99_09/docs/api/ModPerl


-- 
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


Re: How to uninstall mod_perl

Posted by Stas Bekman <st...@stason.org>.
Chris Drake wrote:
> Hi,
> 
> 1. How is mod_perl removed?

I've never tried to do that, but assuming that you have the original build tree:

   make uninstall

should probably work.

> 2. If I wanted to "upgrade" from 2.0_09 to 2.0_12, is there some
>    special way to do this, or must I first uninstall the old before
>    installing the new ?

If you are using the same build arguments, just install over the old one.


__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


-- 
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


How to uninstall mod_perl

Posted by Chris Drake <ch...@pobox.com>.
Hi,

1. How is mod_perl removed?

2. If I wanted to "upgrade" from 2.0_09 to 2.0_12, is there some
   special way to do this, or must I first uninstall the old before
   installing the new ?

Chris.


-- 
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


Re: GIF contents not "coming out"

Posted by Stas Bekman <st...@stason.org>.
Chris Drake wrote:
> Hi All,
> 
> My mod_perl 2 script is not sending back the contents of the GIF I'm
> trying to print.  Running it locally, it does, or if I go:-
> print "foo";
> ... I get "foo" - but when I print the GIF - I just get back the
> headers without any content!!!

Please read on how we like problems to be reported: http://perl.apache.org/bugs/

Make sure to include the relevant config section (is it 'perl-script' or 
'modperl' SetHandler?)

Also any difference if you remove 'use bytes'?

Also this is much more efficient way to read/print a multiline file:

     local $/;
     $::r->print(<GIF>);

__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


-- 
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html