On Thursday, October 24, 2002, at 12:14 AM, Chuck Jacobson wrote:

Please forgive me because in some ways I am a newbie and in some ways I am not. I have written several perl scripts but I have never admin'd a Perl installation. Now I have it on my iBook and G4.

First, I knew perl was in OS X (I'm using 10.2) and I learned about CPAN and started using it. Apparently, I said yes to something during the setup when I shouldn't have and this is what I get when I try to install things with CPAN (like the newest CPAN version):
actually, you said no to something. hence the no/ prefix in a lot of those messages.

try typing

o conf cpan_home /var/root/.cpan

at the cpan prompt. assuming you're running as root.

o conf cpan_home /users/your_username/.cpan

if not. you may also have to

mkdir ~/.cpan

in the terminal first: I don't think it will be done for you at this stage.
that might well be all it takes.

<snip>

I installed perl 5.8.0 according to Apple's directions and it seemingly went fine but I still had the above problem. That's when I asked and someone said I had setup CPAN wrong.
there are debates about the wisdom of those apple-sanctioned instructions, but the consensus seems to be that having followed them - as i did - you might as well go with it.

I'm also having trouble making perl scripts work in my browser and I'm pretty sure its either a permission issue or that perl doesn't know what directory to use. Perl scripts in my home/Sites/cgi-bin directory just show up as text files...and other issues.
the icon is just presenting a finder association with the editing application:
as in other unixes it's the shebang line ( #!/path/to/perl ) which causes your script to be handed over to perl, not the suffix. and unlike macperl, there isn't a perl icon in os x. it's just part of the fabric of the thing.

but anyway, i think your perl probably is set up properly, or you wouldn't be getting as far as the cpan prompt. you just have to check that any script you want executed:

* is executable by the current user. chmod 755 is the norm.

* has the address of your perl interpreter in the shebang. If you followed the appledev instructions, /usr/bin/perl should be fine. you can check by typing /usr/bin/perl -v in the terminal, which should reply:

This is perl, v5.8.0 built for darwin

* is not saved with mac line endings (or if it needs to be, for convenience or whatever, that the shebang is explicitly closed with -- ): perl doesn't see the mac line ending as a, er, line ending, so it reads the whole file as one line, and treats the rest of it as options. or something like that.

If it still doesn't work, it's probably to do with the webserver. To be invoked by a browser, the scripts need to be in a ScriptAliased directory - by default the only one is /Library/Webserver/CGI-Executables - or apache needs to know that it should execute files with that extension in the place where you've put them, which usually involves a small tweak to httpd.conf, or the addition of an .htaccess file with the same tweak in it.


oops. went on a bit. hope there's something useful in there.

will



Reply via email to