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

command line help

Expand Messages
  • burguenolj
    Greetings, I am a real beginner that knows nothing about PERL and looking through books and mailing lists. PROBLEM: I am trying an example code from
    Message 1 of 5 , Sep 8, 2004
    • 0 Attachment
      Greetings,

      I am a real beginner that knows nothing about PERL and looking
      through books and mailing lists. PROBLEM: I am trying an example
      code from O'REILLY's Learning Perl, 3rd edition. The code the
      example is this:

      #!/usr/bin/perl

      @lines = `perldoc -u -f atan2`;
      foreach (@lines) {
      s/\w<([^>]+)>/\U$1/g;
      print;
      }

      I was unable to run it. I contacted the host where my file is
      located and they sent me a message as such:

      ---
      Apache doesn't appear to be able to interpret the results, however,
      if you execute the script from the command line it does work:

      [/home/burgueno/www/scgi-bin]# ./ex2-1.pl
      =over 8

      =item atan2 Y,X

      Returns the arctangent of Y/X in the range -PI to PI.

      For the tangent operation, you may use the MATH::TRIG::TAN
      function, or use the familiar relation:

      sub tan { sin($_[0]) / cos($_[0]) }

      =back
      ---

      Like I said I know nothing about PERL, I have ran a couple of example
      scripts before quite fine. I am confused by the hosts response.
      Would somebody be able to help? Also if you know of any other
      excellent beginner books that would help me out let me know.
    • Jenda Krynicky
      From: burguenolj ... If you want to execute the script as a CGI (even if using mod_cgi or something like that) you need to
      Message 2 of 5 , Sep 8, 2004
      • 0 Attachment
        From: "burguenolj" <creative@...>
        > I am a real beginner that knows nothing about PERL and looking
        > through books and mailing lists. PROBLEM: I am trying an example code
        > from O'REILLY's Learning Perl, 3rd edition. The code the example is
        > this:
        >
        > #!/usr/bin/perl
        >
        > @lines = `perldoc -u -f atan2`;
        > foreach (@lines) {
        > s/\w<([^>]+)>/\U$1/g;
        > print;
        > }
        >
        > I was unable to run it. I contacted the host where my file is
        > located and they sent me a message as such:
        >
        > ---
        > Apache doesn't appear to be able to interpret the results, however, if
        > you execute the script from the command line it does work:

        If you want to execute the script as a CGI (even if using mod_cgi or
        something like that) you need to print the Content-type.

        Try adding

        print "Content-type: text/plain\n\n";

        on top of your script.

        Anyway you'd better install perl on your own computer and try these
        things localy.

        Jenda
        P.S.: It's either Perl (the language) or perl (the interpreter), but
        never PERL.
        ===== Jenda@... === http://Jenda.Krynicky.cz =====
        When it comes to wine, women and song, wizards are allowed
        to get drunk and croon as much as they like.
        -- Terry Pratchett in Sourcery
      • Erik Tank
        The problem that you are running into is that (it sounds like) you are trying to run this through a web server instead of directly from the command prompt.
        Message 3 of 5 , Sep 8, 2004
        • 0 Attachment
          The problem that you are running into is that (it sounds like) you are
          trying to run this through a web server instead of directly from the
          command prompt. Web servers require certain information about the
          document (in this case the output of your program) before it can serve
          it up to the client/browser. Please see below - I have added some lines
          to the program and then you should be able to see the output through a
          browser:

          Erik Tank

          Dreaming about Providence
          And whether mice or men have second tries
          Maybe we've been livin with our eyes half open
          Maybe we're bent and broken, broken
          We were meant to live for so much more
          Meant to Live - Switchfoot


          burguenolj wrote:
          > Greetings,
          >
          > I am a real beginner that knows nothing about PERL and looking
          > through books and mailing lists. PROBLEM: I am trying an example
          > code from O'REILLY's Learning Perl, 3rd edition. The code the
          > example is this:
          >
          > #!/usr/bin/perl

          print("Content-type: text/html\n\n");
          print("<HTML><BODY><PRE>");
          >
          > @lines = `perldoc -u -f atan2`;
          > foreach (@lines) {
          > s/\w<([^>]+)>/\U$1/g;
          > print;
          > }
          >
          > I was unable to run it. I contacted the host where my file is
          > located and they sent me a message as such:
          >
          > ---
          > Apache doesn't appear to be able to interpret the results, however,
          > if you execute the script from the command line it does work:
          >
          > [/home/burgueno/www/scgi-bin]# ./ex2-1.pl
          > =over 8
          >
          > =item atan2 Y,X
          >
          > Returns the arctangent of Y/X in the range -PI to PI.
          >
          > For the tangent operation, you may use the MATH::TRIG::TAN
          > function, or use the familiar relation:
          >
          > sub tan { sin($_[0]) / cos($_[0]) }
          >
          > =back
          > ---
          >
          > Like I said I know nothing about PERL, I have ran a couple of example
          > scripts before quite fine. I am confused by the hosts response.
          > Would somebody be able to help? Also if you know of any other
          > excellent beginner books that would help me out let me know.
          >
          >
          >
          >
          > Unsubscribing info is here: http://help.yahoo.com/help/us/groups/groups-32.html
          > Yahoo! Groups Links
          >
          >
          >
          >
          >
          >
          >
          >
        • burguenolj
          Thank you for your assistance I am successful now.
          Message 4 of 5 , Sep 8, 2004
          • 0 Attachment
            Thank you for your assistance I am successful now.
          • merlyn@stonehenge.com
            ... Jenda Try adding Jenda print Content-type: text/plain n n ; Jenda on top of your script. This won t help the examples that come shortly after that
            Message 5 of 5 , Sep 8, 2004
            • 0 Attachment
              >>>>> "Jenda" == Jenda Krynicky <Jenda@...> writes:

              Jenda> Try adding

              Jenda> print "Content-type: text/plain\n\n";

              Jenda> on top of your script.

              This won't help the examples that come shortly after that one, which
              start using <STDIN>. The proper means to run a program from the
              command line *must* be obtained to complete the exercises.

              --
              Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
              <merlyn@...> <URL:http://www.stonehenge.com/merlyn/>
              Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
              See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
            Your message has been successfully submitted and would be delivered to recipients shortly.