CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 13 of 13
  1. #1
    Join Date
    May 2007
    Posts
    7

    Getting Started with Pearl

    I just got started learning Pearl, and I am trying to get my first script to work. Unfortunately, it does not even run! When I click the "submit" button on the html form, it opens up the Pearl code as text, rather than running it. What am I doing wrong? Thanks!

  2. #2
    Join Date
    May 2007
    Posts
    7

    Re: Getting Started with Pearl

    Well, step one is I should learn to spell Perl . . .

  3. #3
    Join Date
    Aug 2002
    Location
    Brazil
    Posts
    730

    Re: Getting Started with Pearl

    Is your code small? You could paste it here. Make sure it is between <?php ?> tags.

    If you're going to post the code here. Use the [ PHP ] [ /PHP ] (without spaces between the brackets and "PHP"). You can use the PHP button to format the code properly with syntax-highlighting . You can always preview your post before posting.
    Last edited by bubu; May 30th, 2007 at 06:13 PM.
    All consequences are eternal in some way.

  4. #4
    Join Date
    May 2007
    Posts
    7

    Re: Getting Started with Pearl

    #!C:/pearl/bin/perl.exe
    use CGI;
    $query = new CGI;

    $v0= $query->param('v0') ;
    $v01= $query->param('v01') ;
    $v02= $query->param('v02') ;
    $v03= $query->param('v03') ;
    $v04= $query->param('v04') ;
    $v05= $query->param('v05') ;
    $v06= $query->param('v06') ;
    $v07= $query->param('v07') ;
    $v08= $query->param('v08') ;
    $v09= $query->param('v09') ;



    ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
    $year = 1900 + $year;
    $mon= $mon+1;
    $hour = $hour - 1;
    $date1= "$mon/$mday/$year";
    $date2= "$hour:$min:$sec";



    print $query->header;
    print $query->start_html(-title=>'Thank you');

    print "<style type='text/css'>
    body{
    margin: 20;
    padding: 0;
    font-size: 90%;
    font-family: arial;
    color: 'white';}
    </style>";


    open(INFO, ">>$ENV{'DOCUMENT_ROOT_OLD'}/www/data/output.txt");
    print INFO "$v01,$v02,$v03,$v04,$v05,";
    print INFO "endline\n";
    close (INFO);


    print "Thank you for your responses! <BR><BR>";
    print $query->end_html;

  5. #5
    Join Date
    May 2002
    Posts
    10,943

    Re: Getting Started with Pearl

    Yeah, spelling PERL right is a good way to start. Notice your code...
    Code:
    #!C:/pearl/bin/perl.exe
    As Bubu already mentioned, please use code tags when posting code. It makes it much easier to read a thread.

    &#91;code&#93;
    Your code goes here.
    &#91;/code&#93;

    Or

    &#91;php&#93;
    Your code goes here.
    &#91;/php&#93;
    Last edited by PeejAvery; May 30th, 2007 at 09:50 PM.
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

  6. #6
    Join Date
    Aug 2002
    Location
    Brazil
    Posts
    730

    Re: Getting Started with Pearl

    I don't know much about PERL but I bet it would be easier to solve your problem if you tell us:
    - your operating system
    - how did you installed perl on it
    - where is the script that you are running
    - what is the ACTION parameter of the <form> that submits to the PERL page.
    - can you execute any other PERL on your server?

    thanks for attention.
    All consequences are eternal in some way.

  7. #7
    Join Date
    May 2007
    Posts
    7

    Re: Getting Started with Pearl

    - your operating system : Windows XP Tablet Edition


    - how did you installed perl on it : normal location C:\Pearl\bin


    - where is the script that you are running : C:\Documents and Settings\t\Desktop\sandbox\cgi-bin


    - what is the ACTION parameter of the <form> that submits to the PERL page. : <FORM ACTION = 'cgi-bin/self-esteem-savedata.cgi' METHOD = 'post' >


    - can you execute any other PERL on your server? : This is the only one I have tried.

    Thanks!

  8. #8
    Join Date
    May 2002
    Posts
    10,943

    Re: Getting Started with Pearl

    Since you are seeing just the perl text, that means one of two things. One, your installation is bad and the interpreter is not recognized. Two, you have invalidly typed the path to the interpreter. My guess is that the second is true.

    In most cases, so long as you aren't making this a very custom install, the following should be your first line. Try it and then get back to us.

    Code:
    #!/usr/bin/perl
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

  9. #9
    Join Date
    May 2007
    Posts
    7

    Re: Getting Started with Pearl

    I've tried many variations, and I'm still not getting it to work. I have a picture of my Perl installation at http://pantheon.yale.edu/~mis26/images/Perl.jpg.

    It simply shows that perl.exe is in C:\Pearl\bin

  10. #10
    Join Date
    May 2002
    Posts
    10,943

    Re: Getting Started with Pearl

    So try...

    Code:
    #!/Pearl/bin/perl
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

  11. #11
    Join Date
    May 2007
    Posts
    7

    Re: Getting Started with Pearl

    That is one of the ones I tried. I just tried it again, and got the same result: the text of the Perl comes up, but doesn't actually run. . .

  12. #12
    Join Date
    May 2002
    Posts
    10,943

    Re: Getting Started with Pearl

    I would suggest re-installing perl and stick with all the defaults. What server are you running? Have you thought of an all-in-one installer?
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

  13. #13
    Join Date
    May 2007
    Posts
    7

    Re: Getting Started with Pearl

    I'll do a complete reinstall of everything when I have a chance, thanks for the help everyone, at least I know it's (probably) not a straightforward stupid thing I'm doing!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured