Re: Basic question
Wren == Wren Argetlahm [EMAIL PROTECTED] writes: Wren And how is this different/better than just using Wren #!perl? Well, #!perl works only when Perl is in your current directory, so unless you're in the habit of running your programs while cd'ed to /usr/bin, it's not gonna do much good. The #! line does *not* look at PATH. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] 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!
Re: Basic question
On Sat, 22 May 2004 12:50:47 -0600, someone going by the name of Doug McNutt [EMAIL PROTECTED] spake in tongues thusly: You do have the execute bit set don't you? Oh, yeah, I know about the permissions. That's fine. It turned out to be the ./ at the front of the line. . must have been part of the path for the previous UNIX boxes I was working on. Thanks for all your help. -- Tim Bailey |\/ Of all tyrannies, a tyranny exercised for the [EMAIL PROTECTED]|\/ good of its victims may be the most oppressive. [EMAIL PROTECTED] | It may be better to live under robber barons http://www.moonrise.org than under omnipotent moral busybodies. --'--,--@ The robber baron's cruelty may sometimes sleep, his cupidity may at some point be satiated; but those who torment us for our own good will torment us without end, for they do so with the approval of their own conscience. -- C.S. Lewis
Basic question
I recently got a new(er) computer, and I did a fresh install of Jaguar and Perl, etc. on it. Unfortunately, I'm having a very basic problem, and I'm not finding guidance online for it. Now, I have used MacPerl extensively, and have used Perl on UNIX systems as well, but have not installed it there. Basically, it looks like Perl is installed correctly, but it will not recognize the shebang first line. (I understand from online tutorials that I have it set up correctly for OSX, and Perl does exist at that path.) The program runs if I pass it directly to Perl. Oddly enough, shell scripts (which I am less familiar with) don't seem to pay attention to the shebang line either. I am guessing that the problems are related. I have played with the ownership and permissions, but it doesn't seem to fix the problem. Do need to change some other setting? If so, where? [Fujisawa:~/Documents/MacPerl] tim% ls -l test.pl -rwxrwxrwx 1 root staff 45 May 21 23:16 test.pl [Fujisawa:~/Documents/MacPerl] tim% cat test.pl #!/usr/bin/perl -w print Hello World!\n; [Fujisawa:~/Documents/MacPerl] tim% test.pl test.pl: Command not found. [Fujisawa:~/Documents/MacPerl] tim% perl test.pl Hello World! [Fujisawa:~/Documents/MacPerl] tim% [Fujisawa:~/Documents/MacPerl] tim% ls -l *.sh -rwxrwxrwx 1 tim staff 24 May 21 22:54 d.sh [Fujisawa:~/Documents/MacPerl] tim% cat d.sh #!/bin/sh echo 'Hello' [Fujisawa:~/Documents/MacPerl] tim% d.sh d.sh: Command not found. [Fujisawa:~/Documents/MacPerl] tim% /bin/sh d.sh Hello [Fujisawa:~/Documents/MacPerl] tim% -- Tim Bailey |\/ Of all tyrannies, a tyranny exercised for the [EMAIL PROTECTED]|\/ good of its victims may be the most oppressive. [EMAIL PROTECTED] | It may be better to live under robber barons http://www.moonrise.org than under omnipotent moral busybodies. --'--,--@ The robber baron's cruelty may sometimes sleep, his cupidity may at some point be satiated; but those who torment us for our own good will torment us without end, for they do so with the approval of their own conscience. -- C.S. Lewis
Re: Basic question
This might be simply that your search path is not set correctly. Try typing: $ echo $path and see what you get. If . is not in the path, the command it's not finding is the script, not Perl or the Shell. Or, of course, your path might not have the locations of sh or perl. Fix up your path, and I bet you'll be golden Kim On May 22, 2004, at 8:10 AM, Timothy Bailey wrote: I recently got a new(er) computer, and I did a fresh install of Jaguar and Perl, etc. on it. Unfortunately, I'm having a very basic problem, and I'm not finding guidance online for it. Now, I have used MacPerl extensively, and have used Perl on UNIX systems as well, but have not installed it there. Basically, it looks like Perl is installed correctly, but it will not recognize the shebang first line. (I understand from online tutorials that I have it set up correctly for OSX, and Perl does exist at that path.) The program runs if I pass it directly to Perl. Oddly enough, shell scripts (which I am less familiar with) don't seem to pay attention to the shebang line either. I am guessing that the problems are related. I have played with the ownership and permissions, but it doesn't seem to fix the problem. Do need to change some other setting? If so, where? [Fujisawa:~/Documents/MacPerl] tim% ls -l test.pl -rwxrwxrwx 1 root staff 45 May 21 23:16 test.pl [Fujisawa:~/Documents/MacPerl] tim% cat test.pl #!/usr/bin/perl -w print Hello World!\n; [Fujisawa:~/Documents/MacPerl] tim% test.pl test.pl: Command not found. [Fujisawa:~/Documents/MacPerl] tim% perl test.pl Hello World! [Fujisawa:~/Documents/MacPerl] tim% [Fujisawa:~/Documents/MacPerl] tim% ls -l *.sh -rwxrwxrwx 1 tim staff 24 May 21 22:54 d.sh [Fujisawa:~/Documents/MacPerl] tim% cat d.sh #!/bin/sh echo 'Hello' [Fujisawa:~/Documents/MacPerl] tim% d.sh d.sh: Command not found. [Fujisawa:~/Documents/MacPerl] tim% /bin/sh d.sh Hello [Fujisawa:~/Documents/MacPerl] tim% -- Tim Bailey |\/ Of all tyrannies, a tyranny exercised for the [EMAIL PROTECTED]|\/ good of its victims may be the most oppressive. [EMAIL PROTECTED] | It may be better to live under robber barons http://www.moonrise.org than under omnipotent moral busybodies. --'--,--@ The robber baron's cruelty may sometimes sleep, his cupidity may at some point be satiated; but those who torment us for our own good will torment us without end, for they do so with the approval of their own conscience. -- C.S. Lewis Kim Helliwell [EMAIL PROTECTED] Homepage: http://homepage.mac.com/kimgh
Re: Basic question
On Sat, 22 May 2004, Kim Helliwell wrote: This might be simply that your search path is not set correctly. Correct here may be a matter of opinion -- it's not by accident that . is not part of the path by default, as that's a security hazard. The way around this is to make the path explicit on a case by case basis by prefixing ./ to commands you want to run in the current directory: % cat test.pl #!/usr/bin/perl -w print Hello World!\n; % test.pl Hello World! % perl test.pl Hello World! % It's probably best not to put . in the $PATH anymore. -- Chris Devers
Re: Basic question
At 10:10 -0500 5/22/04, Timothy Bailey wrote: Oddly enough, shell scripts (which I am less familiar with) don't seem to pay attention to the shebang line either. I am guessing that the problems are related. You do have the execute bit set don't you? chmod 755 yourScript In any case it's not perl that isn't recognizing the shebang line, it's your working shell. Learn about tool hashing and the rehash command if it's tcsh. If your script is in the current working directory try ./yourscript. That's dot-slash. It will avoid the hashing. Think about creating a $HOME/bin/ directory and adding it to your path in $HOME/.MacOSX/environment.plist. -- -- There are 10 kinds of people: those who understand binary, and those who don't --
Re: Basic question
Given that the Perl executable may be located in any of several places, hard-coding a path into the shebang line isn't all that great an idea. The following will always give you the version of perl that comes first on your search path: #!/usr/bin/env perl -r -- email: [EMAIL PROTECTED]; phone: +1 650-873-7841 http://www.cfcl.com- Canta Forda Computer Laboratory http://www.cfcl.com/Meta - The FreeBSD Browser, Meta Project, etc. http://www.ptf.com/dossier - Prime Time Freeware's DOSSIER series
Re: Basic question
--- Rich Morin [EMAIL PROTECTED] wrote: Given that the Perl executable may be located in any of several places, hard-coding a path into the shebang line isn't all that great an idea. The following will always give you the version of perl that comes first on your search path: #!/usr/bin/env perl That's a cool suggestion, but I had a couple questions. Is it good to hardcode the path to `env`, or just not as bad as hardcoding the path to `perl`? And how is this different/better than just using #!perl? Second, and somewhat more personal, I have an alternate perl (5.8.1) at /usr/local/bin so as not to clobber the default system perl (5.6.0). I also have my path set up so the system default is the first in the path (meaning I need to either type `/usr/local/bin/perl` or `perl5.8` to get my perl). Is this path set up necessary to avoid munging with things that use the system's perl, or are things that use the system's perl set up to bypass the path? __ Do you Yahoo!? Yahoo! Domains Claim yours for only $14.70/year http://smallbusiness.promotions.yahoo.com/offer
basic question
Hi all - a very quick question: I'm a web developer (PHP, javascript etc) with a little Perl and I used to use Applescript about 10 years ago. I want to write a simple script that I can distribute to OS X users along with a folder of images. When clicked (has to be totally simple), the script copies the folder of images and sets the Desktop System Preferences to use the images inside it as the desktop pattern and to change every minute. Should I use Perl or Applescript? Thanks. K + Kynan Hughes phone 9281 2088 fax 9211 4433 mobile 0411 231099 Additive design pty ltd Amitabha pty ltd http://www.additive.net.au Level 4, 104 Commonwealth St Surry Hills NSW 2010 Australia +
Re: basic question
On Mar 24, 2004, at 4:18 PM, kynan wrote: Hi all - a very quick question: I'm a web developer (PHP, javascript etc) with a little Perl and I used to use Applescript about 10 years ago. I want to write a simple script that I can distribute to OS X users along with a folder of images. When clicked (has to be totally simple), the script copies the folder of images and sets the Desktop System Preferences to use the images inside it as the desktop pattern and to change every minute. Should I use Perl or Applescript? Hmmm, I could be wrong, but I think you should probably use Apple's X-Code Developer Tools that come with Mac OS 10.3. You might use Sherm Pendly's CamelBones with perl to do this, but I'm not sher(m). I can't help at all with Applescript. Bill Stephenson --