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

Cant Figure Out Error Message

Expand Messages
  • Will
    Greetings Folks, I am getting an error message I cant figure out. Can someone tell me what I am doing wrong? Here it is:
    Message 1 of 6 , Nov 1, 2002
    • 0 Attachment
      Greetings Folks,

      I am getting an error message I cant figure out. Can
      someone tell me what I am doing wrong? Here it is:

      #####################################################

      Fri Nov 1 23:52:55 2002] [error] [client
      xxx.xxx.xxx.xxx] File does not exist:
      /home/xyz/public_html/500.shtml [Fri Nov 1 23:52:55
      2002] [error] [client xxx.xxx.xxx.xxx]
      Premature end of script headers:
      /home/xyz/public_html/cgi-bin/mail-form.cgi
      Use of uninitialized value in concatenation (.) or
      string at /home/xyz/public_html/cgi-bin/mail-form.cgi
      line 41.
      Use of uninitialized value in concatenation (.) or
      string at /home/xyz/public_html/cgi-bin/mail-form.cgi
      line 40.

      #####################################################

      Here's the actual script. The line numbers are next
      to the comment in parentheses.

      #####################################################

      #!/usr/bin/perl -w

      ##### DECLARE MODULES #####

      use strict;
      use CGI;


      ##### DECLARE MODULE OBJECTS #####

      my $cgi = new CGI;


      ##### DECLARE VARIABLES (14) #####

      my $mailprog = '/usr/sbin/sendmail';
      my $recipient = 'webmaster@...';

      my $ip = $ENV{'REMOTE_ADDR'};
      my $server_protocol = $ENV{'SERVER_PROTOCOL'};
      my $host = $ENV{'REMOTE_HOST'};
      my $referrer = $ENV{'HTTP_FROM'};

      my $name = $cgi->param("name");
      my $email = $cgi->param("email");
      my $message = $cgi->param("message");


      ##### Now send mail to $recipient (29) #####

      open (MAIL, "|$mailprog -t") || die "Can't open
      $mailprog!\n";
      print MAIL "To: $recipient\n";
      print MAIL "From: webserver\n";
      print MAIL "Subject: Email From The Website\n\n";
      print MAIL "FROM: $name at EMAIL: $email says:";
      print MAIL "\n\n";
      print MAIL "$message";
      print MAIL "\n\n";
      print MAIL "Server protocol: $server_protocol\n";
      print MAIL "HTTP From: $referrer \n";
      print MAIL "Remote host: $host \n";
      print MAIL "Remote IP address: $ip\n";
      close (MAIL);

      ##### PRINT A REDIRECT SCRIPT (46) #####
      print
      "Location:http://www.xyz.com/mailform-confirmation.htm";

      #####################################################


      The script accepts input from an HTML form, and it
      runs in so far as it will deliver the mail with all
      the form fields, but it still spits out the error
      message and wont redirect to the next page.

      Any help much appreciated.

      Thanks,

      Will

      __________________________________________________
      Do you Yahoo!?
      HotJobs - Search new jobs daily now
      http://hotjobs.yahoo.com/
    • Jeff 'japhy' Pinyan
      ... Those two *warning* messages mean you re using variables whose values are undef. It s GOOD THAT YOU GET THIS WARNING. You re using -w. This helps you
      Message 2 of 6 , Nov 2, 2002
      • 0 Attachment
        On Nov 1, Will said:

        >Use of uninitialized value in concatenation (.) or
        >string at /home/xyz/public_html/cgi-bin/mail-form.cgi
        >line 41.

        >Use of uninitialized value in concatenation (.) or
        >string at /home/xyz/public_html/cgi-bin/mail-form.cgi
        >line 40.

        Those two *warning* messages mean you're using variables whose values are
        undef. It's GOOD THAT YOU GET THIS WARNING. You're using -w. This helps
        you debug problems.

        >#!/usr/bin/perl -w
        >
        >##### DECLARE MODULES #####
        >
        >use strict;
        >use CGI;

        YAY! -w, strict, and CGI. Congratulations!

        >my $referrer = $ENV{'HTTP_FROM'};
        >my $host = $ENV{'REMOTE_HOST'};

        These two variables are giving you trouble. I'm not sure about
        REMOTE_HOST, but I know HTTP_FORM is incorrect. HTTP_REFERER (sic) is the
        %ENV key you want instead of HTTP_FROM. Perhaps your server doesn't
        auto-resolve REMOTE_ADDR to REMOTE_HOST. You might just want to use
        REMOTE_ADDR instead.

        >open (MAIL, "|$mailprog -t") || die "Can't open
        >$mailprog!\n";

        You should probably include

        use CGI::Carp 'fatalsToBrowser';

        at the top of your program so that the 'die' message goes to the browser,
        so it's easier to debug problems.

        >print
        >"Location:http://www.xyz.com/mailform-confirmation.htm";

        You need a newline after each header, and you need another newline after
        all the headers.

        print "This: here\n";
        print "That: there\n";
        print "Location: http://...\n\n";

        --
        Jeff "japhy" Pinyan japhy@... http://www.pobox.com/~japhy/
        RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/
        <stu> what does y/// stand for? <tenderpuss> why, yansliterate of course.
        [ I'm looking for programming work. If you like my work, let me know. ]
      • Will
        Greets Peeps, Jeff said --- It s GOOD THAT YOU GET THIS WARNING. You re using -w. This helps you debug problems. --- Aye, yah, the problem has been figuring
        Message 3 of 6 , Nov 3, 2002
        • 0 Attachment
          Greets Peeps,

          Jeff said ---> It's GOOD THAT YOU GET THIS WARNING.
          You're using -w. This helps you debug problems. ---

          Aye, yah, the problem has been figuring out where to
          access the error log. My host keeps it tucked away
          nicely, but once I located it things have been going
          much better. But, I still have to go through a bunch
          of stuff to access it, and it lists the errors in a
          confused, reverse order, so we can see the importance
          of your next point...

          Jeff then said ---> You should probably include

          use CGI::Carp 'fatalsToBrowser';

          at the top of your program so that the 'die' message
          goes to the browser, so it's easier to debug problems.
          ---

          This is good, but I put this line (and only this line
          just as it is written) into the code at the module
          calls, but it didnt do anything new even when I kept
          the errors in place.

          Also, is this part of CGI.pm or a standalone module?

          TFTH!
          =)

          Will

          __________________________________________________
          Do you Yahoo!?
          HotJobs - Search new jobs daily now
          http://hotjobs.yahoo.com/
        • Nathan.Jeffrey@dhs.vic.gov.au
          Hmm. It seems to be interpreting your quoted strings as code. That s damn odd. Are there any single periods on lines by themselves? That tends to terminate
          Message 4 of 6 , Nov 3, 2002
          • 0 Attachment
            Hmm. It seems to be interpreting your quoted strings as code. That's
            damn odd.

            Are there any single periods on lines by themselves? That tends to
            terminate mail messages, IIRC.

            Can I get a copy of the output?

            N






            Will <self_deprecated@...>
            02/11/2002 06:39 PM
            Please respond to perl-beginner


            To: Perl Beginner <perl-beginner@yahoogroups.com>
            cc:
            Subject: [PBML] Cant Figure Out Error Message


            Greetings Folks,

            I am getting an error message I cant figure out. Can
            someone tell me what I am doing wrong? Here it is:

            #####################################################

            Fri Nov 1 23:52:55 2002] [error] [client
            xxx.xxx.xxx.xxx] File does not exist:
            /home/xyz/public_html/500.shtml [Fri Nov 1 23:52:55
            2002] [error] [client xxx.xxx.xxx.xxx]
            Premature end of script headers:
            /home/xyz/public_html/cgi-bin/mail-form.cgi
            Use of uninitialized value in concatenation (.) or
            string at /home/xyz/public_html/cgi-bin/mail-form.cgi
            line 41.
            Use of uninitialized value in concatenation (.) or
            string at /home/xyz/public_html/cgi-bin/mail-form.cgi
            line 40.

            #####################################################

            Here's the actual script. The line numbers are next
            to the comment in parentheses.

            #####################################################

            #!/usr/bin/perl -w

            ##### DECLARE MODULES #####

            use strict;
            use CGI;


            ##### DECLARE MODULE OBJECTS #####

            my $cgi = new CGI;


            ##### DECLARE VARIABLES (14) #####

            my $mailprog = '/usr/sbin/sendmail';
            my $recipient = 'webmaster@...';

            my $ip = $ENV{'REMOTE_ADDR'};
            my $server_protocol = $ENV{'SERVER_PROTOCOL'};
            my $host = $ENV{'REMOTE_HOST'};
            my $referrer = $ENV{'HTTP_FROM'};

            my $name = $cgi->param("name");
            my $email = $cgi->param("email");
            my $message = $cgi->param("message");


            ##### Now send mail to $recipient (29) #####

            open (MAIL, "|$mailprog -t") || die "Can't open
            $mailprog!\n";
            print MAIL "To: $recipient\n";
            print MAIL "From: webserver\n";
            print MAIL "Subject: Email From The Website\n\n";
            print MAIL "FROM: $name at EMAIL: $email says:";
            print MAIL "\n\n";
            print MAIL "$message";
            print MAIL "\n\n";
            print MAIL "Server protocol: $server_protocol\n";
            print MAIL "HTTP From: $referrer \n";
            print MAIL "Remote host: $host \n";
            print MAIL "Remote IP address: $ip\n";
            close (MAIL);

            ##### PRINT A REDIRECT SCRIPT (46) #####
            print
            "Location:http://www.xyz.com/mailform-confirmation.htm";

            #####################################################


            The script accepts input from an HTML form, and it
            runs in so far as it will deliver the mail with all
            the form fields, but it still spits out the error
            message and wont redirect to the next page.

            Any help much appreciated.

            Thanks,

            Will

            __________________________________________________
            Do you Yahoo!?
            HotJobs - Search new jobs daily now
            http://hotjobs.yahoo.com/


            Unsubscribing info is here:
            http://help.yahoo.com/help/us/groups/groups-32.html

            Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/







            _________________________________________________________________________________

            This email contains confidential information intended only for the person named above and may be subject to legal privilege. If you are not the intended recipient, any disclosure, copying or use of this information is prohibited. The Department provides no guarantee that this communication is free of virus or that it has not been intercepted or interfered with. If you have received this email in error or have any other concerns regarding its transmission, please notify Postmaster@...
            _________________________________________________________________________________
          • Will
            Nathan said --- Can I get a copy of the output? --- I already corrected some of the code, but I am still getting those two error messages (in my error logs).
            Message 5 of 6 , Nov 4, 2002
            • 0 Attachment
              Nathan said ---> Can I get a copy of the output? ---

              I already corrected some of the code, but I am still
              getting those two error messages (in my error logs).
              The script (below) sends the email, and the email
              looks as one would expect it to turn out, but it just
              doesnt list anything in those two variables.

              Using CGI::Carp 'fatalsToBroswer'; wont yield any
              error messages in the browser, but in the error log it
              still shows up (also as quoted below).

              Dunno what's wrong yet, but I'm not done with it
              either. ;)

              Will

              --------------------------------------------------
              --- Nathan.Jeffrey@... wrote:
              > Hmm. It seems to be interpreting your quoted
              > strings as code. That's
              > damn odd.
              >
              >Are there any single periods on lines by themselves?
              That tends to terminate mail messages, IIRC. Can I get
              a copy of the output?
              >
              > N
              >
              >
              >
              >
              >
              >
              > Will <self_deprecated@...>
              > 02/11/2002 06:39 PM
              > Please respond to perl-beginner
              >
              >
              > To: Perl Beginner
              > <perl-beginner@yahoogroups.com>
              > cc:
              > Subject: [PBML] Cant Figure Out Error
              > Message
              >
              >
              > Greetings Folks,
              >
              > I am getting an error message I cant figure out. Can
              > someone tell me what I am doing wrong? Here it is:
              >
              >
              #####################################################
              >
              > Fri Nov 1 23:52:55 2002] [error] [client
              > xxx.xxx.xxx.xxx] File does not exist:
              > /home/xyz/public_html/500.shtml [Fri Nov 1 23:52:55
              > 2002] [error] [client xxx.xxx.xxx.xxx]
              > Premature end of script headers:
              > /home/xyz/public_html/cgi-bin/mail-form.cgi
              > Use of uninitialized value in concatenation (.) or
              > string at
              > /home/xyz/public_html/cgi-bin/mail-form.cgi
              > line 41.
              > Use of uninitialized value in concatenation (.) or
              > string at
              > /home/xyz/public_html/cgi-bin/mail-form.cgi
              > line 40.
              >
              >
              #####################################################
              >
              > Here's the actual script. The line numbers are next
              > to the comment in parentheses.
              >
              >
              #####################################################
              >
              > #!/usr/bin/perl -w
              >
              > ##### DECLARE MODULES #####
              >
              > use strict;
              > use CGI;
              >
              >
              > ##### DECLARE MODULE OBJECTS #####
              >
              > my $cgi = new CGI;
              >
              >
              > ##### DECLARE VARIABLES (14) #####
              >
              > my $mailprog = '/usr/sbin/sendmail';
              > my $recipient = 'webmaster@...';
              >
              > my $ip = $ENV{'REMOTE_ADDR'};
              > my $server_protocol = $ENV{'SERVER_PROTOCOL'};
              > my $host = $ENV{'REMOTE_HOST'};
              > my $referrer = $ENV{'HTTP_FROM'};
              >
              > my $name = $cgi->param("name");
              > my $email = $cgi->param("email");
              > my $message = $cgi->param("message");
              >
              >
              > ##### Now send mail to $recipient (29) #####
              >
              > open (MAIL, "|$mailprog -t") || die "Can't open
              > $mailprog!\n";
              > print MAIL "To: $recipient\n";
              > print MAIL "From: webserver\n";
              > print MAIL "Subject: Email From The Website\n\n";
              > print MAIL "FROM: $name at EMAIL: $email says:";
              > print MAIL "\n\n";
              > print MAIL "$message";
              > print MAIL "\n\n";
              > print MAIL "Server protocol: $server_protocol\n";
              > print MAIL "HTTP From: $referrer \n";
              > print MAIL "Remote host: $host \n";
              > print MAIL "Remote IP address: $ip\n";
              > close (MAIL);
              >
              > ##### PRINT A REDIRECT SCRIPT (46) #####
              > print
              >
              "Location:http://www.xyz.com/mailform-confirmation.htm";
              >
              >
              #####################################################
              >
              >
              > The script accepts input from an HTML form, and it
              > runs in so far as it will deliver the mail with all
              > the form fields, but it still spits out the error
              > message and wont redirect to the next page.
              >
              > Any help much appreciated.
              >
              > Thanks,
              >
              > Will
              >
              > __________________________________________________
              > Do you Yahoo!?
              > HotJobs - Search new jobs daily now
              > http://hotjobs.yahoo.com/
              >
              >
              > Unsubscribing info is here:
              > http://help.yahoo.com/help/us/groups/groups-32.html
              >
              > Your use of Yahoo! Groups is subject to
              > http://docs.yahoo.com/info/terms/
              >
              >
              >
              >
              >
              >
              >
              >
              _________________________________________________________________________________
              >
              > This email contains confidential information
              > intended only for the person named above and may be
              > subject to legal privilege. If you are not the
              > intended recipient, any disclosure, copying or use
              > of this information is prohibited. The Department
              > provides no guarantee that this communication is
              > free of virus or that it has not been intercepted or
              > interfered with. If you have received this email in
              > error or have any other concerns regarding its
              > transmission, please notify
              > Postmaster@...
              >
              _________________________________________________________________________________
              >
              >


              __________________________________________________
              Do you Yahoo!?
              HotJobs - Search new jobs daily now
              http://hotjobs.yahoo.com/
            • Nathan.Jeffrey@dhs.vic.gov.au
              I d jam a whole bunch of redundant print staements in there, like printing to STDOUT as well as MAIL. And run it through the debugger, too. N Will
              Message 6 of 6 , Nov 5, 2002
              • 0 Attachment
                I'd jam a whole bunch of redundant print staements in there, like printing
                to STDOUT as well as MAIL. And run it through the debugger, too.

                N





                Will <self_deprecated@...>
                04/11/2002 09:28 PM
                Please respond to perl-beginner


                To: perl-beginner@yahoogroups.com
                cc:
                Subject: Re: [PBML] Cant Figure Out Error Message


                Nathan said ---> Can I get a copy of the output? ---

                I already corrected some of the code, but I am still
                getting those two error messages (in my error logs).
                The script (below) sends the email, and the email
                looks as one would expect it to turn out, but it just
                doesnt list anything in those two variables.

                Using CGI::Carp 'fatalsToBroswer'; wont yield any
                error messages in the browser, but in the error log it
                still shows up (also as quoted below).

                Dunno what's wrong yet, but I'm not done with it
                either. ;)

                Will

                --------------------------------------------------
                --- Nathan.Jeffrey@... wrote:
                > Hmm. It seems to be interpreting your quoted
                > strings as code. That's
                > damn odd.
                >
                >Are there any single periods on lines by themselves?
                That tends to terminate mail messages, IIRC. Can I get
                a copy of the output?
                >
                > N
                >
                >
                >
                >
                >
                >
                > Will <self_deprecated@...>
                > 02/11/2002 06:39 PM
                > Please respond to perl-beginner
                >
                >
                > To: Perl Beginner
                > <perl-beginner@yahoogroups.com>
                > cc:
                > Subject: [PBML] Cant Figure Out Error
                > Message
                >
                >
                > Greetings Folks,
                >
                > I am getting an error message I cant figure out. Can
                > someone tell me what I am doing wrong? Here it is:
                >
                >
                #####################################################
                >
                > Fri Nov 1 23:52:55 2002] [error] [client
                > xxx.xxx.xxx.xxx] File does not exist:
                > /home/xyz/public_html/500.shtml [Fri Nov 1 23:52:55
                > 2002] [error] [client xxx.xxx.xxx.xxx]
                > Premature end of script headers:
                > /home/xyz/public_html/cgi-bin/mail-form.cgi
                > Use of uninitialized value in concatenation (.) or
                > string at
                > /home/xyz/public_html/cgi-bin/mail-form.cgi
                > line 41.
                > Use of uninitialized value in concatenation (.) or
                > string at
                > /home/xyz/public_html/cgi-bin/mail-form.cgi
                > line 40.
                >
                >
                #####################################################
                >
                > Here's the actual script. The line numbers are next
                > to the comment in parentheses.
                >
                >
                #####################################################
                >
                > #!/usr/bin/perl -w
                >
                > ##### DECLARE MODULES #####
                >
                > use strict;
                > use CGI;
                >
                >
                > ##### DECLARE MODULE OBJECTS #####
                >
                > my $cgi = new CGI;
                >
                >
                > ##### DECLARE VARIABLES (14) #####
                >
                > my $mailprog = '/usr/sbin/sendmail';
                > my $recipient = 'webmaster@...';
                >
                > my $ip = $ENV{'REMOTE_ADDR'};
                > my $server_protocol = $ENV{'SERVER_PROTOCOL'};
                > my $host = $ENV{'REMOTE_HOST'};
                > my $referrer = $ENV{'HTTP_FROM'};
                >
                > my $name = $cgi->param("name");
                > my $email = $cgi->param("email");
                > my $message = $cgi->param("message");
                >
                >
                > ##### Now send mail to $recipient (29) #####
                >
                > open (MAIL, "|$mailprog -t") || die "Can't open
                > $mailprog!\n";
                > print MAIL "To: $recipient\n";
                > print MAIL "From: webserver\n";
                > print MAIL "Subject: Email From The Website\n\n";
                > print MAIL "FROM: $name at EMAIL: $email says:";
                > print MAIL "\n\n";
                > print MAIL "$message";
                > print MAIL "\n\n";
                > print MAIL "Server protocol: $server_protocol\n";
                > print MAIL "HTTP From: $referrer \n";
                > print MAIL "Remote host: $host \n";
                > print MAIL "Remote IP address: $ip\n";
                > close (MAIL);
                >
                > ##### PRINT A REDIRECT SCRIPT (46) #####
                > print
                >
                "Location:http://www.xyz.com/mailform-confirmation.htm";
                >
                >
                #####################################################
                >
                >
                > The script accepts input from an HTML form, and it
                > runs in so far as it will deliver the mail with all
                > the form fields, but it still spits out the error
                > message and wont redirect to the next page.
                >
                > Any help much appreciated.
                >
                > Thanks,
                >
                > Will
                >
                > __________________________________________________
                > Do you Yahoo!?
                > HotJobs - Search new jobs daily now
                > http://hotjobs.yahoo.com/
                >
                >
                > Unsubscribing info is here:
                > http://help.yahoo.com/help/us/groups/groups-32.html
                >
                > Your use of Yahoo! Groups is subject to
                > http://docs.yahoo.com/info/terms/
                >
                >
                >
                >
                >
                >
                >
                >
                _________________________________________________________________________________
                >
                > This email contains confidential information
                > intended only for the person named above and may be
                > subject to legal privilege. If you are not the
                > intended recipient, any disclosure, copying or use
                > of this information is prohibited. The Department
                > provides no guarantee that this communication is
                > free of virus or that it has not been intercepted or
                > interfered with. If you have received this email in
                > error or have any other concerns regarding its
                > transmission, please notify
                > Postmaster@...
                >
                _________________________________________________________________________________
                >
                >


                __________________________________________________
                Do you Yahoo!?
                HotJobs - Search new jobs daily now
                http://hotjobs.yahoo.com/


                Unsubscribing info is here:
                http://help.yahoo.com/help/us/groups/groups-32.html

                Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/







                _________________________________________________________________________________

                This email contains confidential information intended only for the person named above and may be subject to legal privilege. If you are not the intended recipient, any disclosure, copying or use of this information is prohibited. The Department provides no guarantee that this communication is free of virus or that it has not been intercepted or interfered with. If you have received this email in error or have any other concerns regarding its transmission, please notify Postmaster@...
                _________________________________________________________________________________
              Your message has been successfully submitted and would be delivered to recipients shortly.