Loading ...
Sorry, an error occurred while loading the content.
 

Printing to STDOUT/browser

Expand Messages
  • Christopher E. Welton
    Folks: I recently re-installed mod_perl on my development computer from source. I downgraded from Apache2/mp2 to Apache 1.3.29/mp 1.29 in order to match
    Message 1 of 2 , Mar 1, 2004
      Folks:

      I recently re-installed mod_perl on my development computer from source.
      I downgraded from Apache2/mp2 to Apache 1.3.29/mp 1.29 in order to match
      versions with my production server.

      Since the reinstall I have had a strange problem. Printing small strings
      like "foo" using "print" without a filehandle or "croak" have not
      yielded any output to either the browser or the error_log. Printing long
      strings works ok, like printing the results of a cgi::formbuilder
      script. This leads me to believe that this may be a buffering problem.
      However, I have never encountered this behavior with MP before and have
      not had problems with buffering in MP before. Can someone offer a
      pointer?

      Also, if anyone knows how to have apache/mp send errors to the browser
      directly rather than to the error_log, that would be much appreciated.

      Details:

      I am running RH9 on AMD Athlon; Linux version 2.4.20-8
      (bhcompile@...) (gcc version 3.2.2 20030222 (Red
      Hat Linux 3.2.2-5))

      The relevant portion of my httpd.conf is as follows:

      PerlRequire /var/www/perl/startup.pl
      #PerlOptions +SetupEnv
      PerlSetVar StatusOptionsAll On
      #PerlSwitches -w
      #PerlSwitches -T
      #PerlModule Apache::Status
      PerlSetEnv INSTALL_DIR "/var/www/soap/lead_site"
      PerlSetEnv IS_DEV 1
      PerlSetEnv EMAIL_SUPP_DIR "/var/www/soap/email_suppression"
      PerlRequire
      /usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi/Apache/Registry.pm
      Alias /index.html /index.pl
      DirectoryIndex index.htm index.html index.pl

      Alias /email/ /var/www/soap/email_suppression/
      <Location /email>
      DirectoryIndex index.pl
      AllowOverride All
      # PerlFixupHandler +Apache::DB
      # PerlOptions +SetupEnv
      AddHandler perl-script .cgi .pl
      # reload modules upon change
      PerlInitHandler Apache::Reload
      PerlHandler Apache::Registry
      PerlSendHeader On
      Options +ExecCGI
      </Location>

      My Startup.pl looks like:

      use strict;
      use warnings FATAL => 'all';
      use 5.008;

      use Apache::Log ();

      use Apache::Debug ();
      use Apache::DBI ();

      use CGI;
      CGI->compile(':all');
      use Apache::DBI;
      DBI->install_driver("mysql");

      use Apache::Request;
      use Apache::File;
      use Apache::Constants qw(:common REDIRECT);
      use Apache::Util qw(:all);

      1;


      --
      Best,

      Chris Welton
      M a x M e d i a
      New Media. New Revenues. Max Results.

      Max Media
      P.O. Box 5812
      Santa Monica, CA 90409-5812

      phone: 562-946-3370
      cellular: 562-659-3072
      fax: 703-940-8261
      http://www.maxmediamarketing.com
      ting.com


      --
      Report problems: 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
    • Stas Bekman
      ... It s possible that some code that you use changes $| w/o localizing it.
      Message 2 of 2 , Mar 1, 2004
        Christopher E. Welton wrote:
        > Folks:
        >
        > I recently re-installed mod_perl on my development computer from source.
        > I downgraded from Apache2/mp2 to Apache 1.3.29/mp 1.29 in order to match
        > versions with my production server.
        >
        > Since the reinstall I have had a strange problem. Printing small strings
        > like "foo" using "print" without a filehandle or "croak" have not
        > yielded any output to either the browser or the error_log. Printing long
        > strings works ok, like printing the results of a cgi::formbuilder
        > script. This leads me to believe that this may be a buffering problem.
        > However, I have never encountered this behavior with MP before and have
        > not had problems with buffering in MP before. Can someone offer a
        > pointer?

        It's possible that some code that you use changes $| w/o localizing it.
        http://perl.apache.org/docs/general/perl_reference/perl_reference.html#The_Scope_of_the_Special_Perl_Variables

        > Also, if anyone knows how to have apache/mp send errors to the browser
        > directly rather than to the error_log, that would be much appreciated.

        CGI::Carp::fatals_to_browser

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

        --
        Report problems: 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
      Your message has been successfully submitted and would be delivered to recipients shortly.