There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
 
Tag Cloud
access audio avg avg 8 bios blue screen boot bsod computer connection cpu crash css dell desktop dma driver drivers dvd email error excel explorer firefox firefox 3 freeze gimp graphics hard drive hardware hijackthis hjt install internet internet explorer itunes keyboard laptop macro malware monitor motherboard network networking outlook outlook 2003 outlook 2007 outlook express pio problem problems router seo server slow sound sp3 spyware trojan usb video virtumonde virus vista vundo windows windows vista windows xp winxp wireless
Software Development
Search
Search in:
 
Advanced Search
Tech Support Guy Forums > Software & Hardware > Software Development >
perl self-executable


HELLO AND WELCOME! Before you can post your question, you'll have to register -- it's completely free! Click here to join today! We highly recommend that you print a copy of our Guide for New Members. Enjoy!

 
Thread Tools
gamemaster_bm2's Avatar
Member with 78 posts.
 
Join Date: Jul 2001
16-Oct-2003, 08:48 PM #1
perl self-executable
i just started learning to use perl, and i cant seem to get my programs to execute without invoking perl to compile it
i tried everything in the man pages, and cant seem to figure it out
its proabably some little thing im overlooking, but help would be appreciated
Running Mandrake-Linux 8
codejockey's Avatar
Senior Member with 1,410 posts.
 
Join Date: Feb 2002
17-Oct-2003, 02:08 AM #2
A couple of thoughts:

(1) have you make sure that the perl program is executable? Typically, you would use a command such as chmod 755 perl-program-name or chmod a+x perl-program-name to set the execute bit for all users. If you type ls -l perl-program-name and see something such as rw-rw-rw (i.e., without an x in any position), then the chmod command should do the trick. Note that you must be the owner of the script or root in order to modify the permissions.

(2) have you verified that the first line in your script is something like: #! /usr/bin/perl? This directs the shell to use /usr/bin/perl as the interpreter for the script (note that your path to perl may be different). Without this line, you may receive syntax errors and various other complaints, forcing you to invoke the script as perl perl-program-name.

My guess is that the first option is the more likely.

Hope this helps.
__________________
The slowest component still sits at the keyboard.
gamemaster_bm2's Avatar
Member with 78 posts.
 
Join Date: Jul 2001
17-Oct-2003, 10:12 PM #3
im pretty sure its my chmod statement, but i cant figure out why it doesnt turn on the execute bit...
ive tried chmod +x filename, chmod a+x filename, any others?
codejockey's Avatar
Senior Member with 1,410 posts.
 
Join Date: Feb 2002
18-Oct-2003, 02:41 AM #4
If you are either root or the owner of the file, chmod a+x filename or chmod +x filename should work, as should chmod 755 filename. You might try running fsck on the filesystem, to make sure there are no problems in the filesystem itself that may affect your results.

Other possibilities: what error(s) do you receive when you try to execute your perl script(s) directly? Note that a "file not found" or similar error may mean that the directory that contains the script to be executed is not in your path; the current directory is typically excluded from root's path for security reasons.

When you execute the chmod command, try capturing the return code -- there may be a clue there. You can try: chmod a+x filename; echo $? to see the return code.

By any chance, is the perl script a symbolic link to another file? If so, you will not be able to change the permissions on a symbolic link (they don't matter, anyway), but the permissions on the file pointed to by the link should change (OK, it's a long shot, I admit ...).

Finally, how is the filesystem mounted? If it is mounted read-only, you will be unable to change any file attributes (although I would expect you'd receive an error message if you attempted to modify anything in the filesystem).

It sure seems like you've covered the obvious bases. Additional info appreciated.

Hope this helps.
__________________
The slowest component still sits at the keyboard.
gamemaster_bm2's Avatar
Member with 78 posts.
 
Join Date: Jul 2001
19-Oct-2003, 10:18 PM #5
i finally got it, i was using the switch -x instead of +x, i dont know why i missed this, but it was a pretty obvious error once i saw it, thanks anyway
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are Off
Refbacks are Off

You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 06:37 PM.
Copyright © 1996 - 2008 TechGuy, Inc. All rights reserved.
Powered by vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Powered by Cermak Technologies, Inc.