New question! PERL script doesn't execute

Discussion in 'Mac Programming' started by digital1, Dec 6, 2005.

  1. macrumors 6502

    digital1

    Joined:
    Jan 2, 2002
    Location:
    Wisconsin
    #1
    Ok! I have another question.I couldnt find my other post so I will post another another thread. What happens is that I have a perl module and script. The Perl script doesn't execute in the cgi-bin, but outside of cgi-bin it executes.Permissions on the perl script are 755. I am really confused and no one knows how to help me. Any suggestions?
     
  2. macrumors 603

    jeremy.king

    Joined:
    Jul 23, 2002
    Location:
    Fuquay Varina, NC
    #2
    How are you trying to execute them? Through a web browser request or from the command line? If its from a web browser, check that your apache http server is configured correctly...
     
  3. thread starter macrumors 6502

    digital1

    Joined:
    Jan 2, 2002
    Location:
    Wisconsin
    #3

    I am trying to execute it from command line. Its a driver test script to test a module in the same directory. Thanks :)
     
  4. macrumors 603

    jeremy.king

    Joined:
    Jul 23, 2002
    Location:
    Fuquay Varina, NC
    #4
    Ok - what error is it giving exactly? The directory shouldn't matter if you are executing from command line, unless you have specific relative paths in your script. weird....
     
  5. thread starter macrumors 6502

    digital1

    Joined:
    Jan 2, 2002
    Location:
    Wisconsin
    #5
    It doesn't give an error. When I go to command line to execute the script, it acts like its going to execute but doesn't. So for example:

    [user@someserver]: ./this_is_the_script.pl

    [user@someserver]: {nothing would be here, just blinking cursor}
     
  6. macrumors 603

    jeremy.king

    Joined:
    Jul 23, 2002
    Location:
    Fuquay Varina, NC
    #6
    have you tried doing a
    Code:
    perl this_is_the_script.pl
     
  7. thread starter macrumors 6502

    digital1

    Joined:
    Jan 2, 2002
    Location:
    Wisconsin
    #7
    Yes I have and it works. The problem is, is that this script is just a driver to test if a local perl module works. The problem is, is that I cannot store the output of the work of the Perl module in the local script so I can manipulate it. The test script just outputs whats stored in the variable of the script.It seems outside of the cgi-bin, I can get to the data that the perl module collects and store it locally within the memory space of the current running script, but within the cgi-bin, it just shows nothing.
     
  8. macrumors 603

    jeremy.king

    Joined:
    Jul 23, 2002
    Location:
    Fuquay Varina, NC
    #8
    For clarity, this works both inside and outside of your cgi-bin directory? If it does indeed work both in and out, then this usually indicates a problem with permissions or the compiler declarations on the first line.

    Also, if you want to take this discussion outside of your thread, I would be willing to ssh/telnet in to see if we can figure this out. If you want PM me a servername/login/pass to use.
     
  9. thread starter macrumors 6502

    digital1

    Joined:
    Jan 2, 2002
    Location:
    Wisconsin
    #9

    When I run it as 'perl this_script.pl' inside and outside of cgi-bin, it works. But when I run it as ./this_script.pl or this_script.pl inside cgi-bin, it does not work. I don't know if the professor would let me add another user to the server, when I don't have rights to do that myself :) Thanks though for ALL the help and suggestions.
     
  10. thread starter macrumors 6502

    digital1

    Joined:
    Jan 2, 2002
    Location:
    Wisconsin
    #10

    I could email you the scripts so you can run through them quick though...
     
  11. macrumors 603

    jeremy.king

    Joined:
    Jul 23, 2002
    Location:
    Fuquay Varina, NC
    #11
    that may work.

    Like I mentioned before, if the perl command works but the . command doesn't its usually indicative of permissions or declarative problems.

    PS. Let your prof know that I am a local. I work in Glendale :)

    kingjr3@yahoo*SPAMDAMMYDO].com
     
  12. macrumors 68030

    superbovine

    Joined:
    Nov 7, 2003
    #12
    chmod 777
     
  13. thread starter macrumors 6502

    digital1

    Joined:
    Jan 2, 2002
    Location:
    Wisconsin
    #13
    Have tried that already on the file and the folder.
     
  14. macrumors 6502a

    Joined:
    Feb 24, 2005
    Location:
    Somerset
    #14
    Is this not an issue with your sh-bang statement on the first line:

    do a 'which perl'

    sreedy$ which perl
    /usr/bin/perl

    and check that you've got #!/usr/bin/perl as the first line in your script.

    That's my best guess after reading this thread.

    my $0.02
     
  15. thread starter macrumors 6502

    digital1

    Joined:
    Jan 2, 2002
    Location:
    Wisconsin
    #15

    Everything matches up. Still no go. :( Thanks for the response though.
     

Share This Page