[Brisbane-pm] Lost in OSX

Stephen Steneker stephen at sydney.pm.org
Tue Sep 18 03:16:50 PDT 2007


> Do any of you work in Mac OS X?

Hi Martin,

I work in Sydney, but I use OS X ;-).

> I've got some pretty basic questions, such as...
>
> 1 I thought I installed Perl 5.8.8 from ActiveState, but when I  
> type perl -v in terminal it says...
>
> This is perl, v5.8.6 built for darwin-thread-multi-2level
> (with 3 registered patches, see perl -V for more detail)
>
> What gives?

This is the Apple-installed Perl.  I'd recommend using it, unless you
have a specific inclination for building your own version of perl.

In my experience, building your own perl is generally a less
hassle-some choice than using ActiveState because at some
point you'll want to install newer modules than are available
via their ppm repositories.  I prefer to use the default perl
and CPAN tools, which work just fine.

> 2 How do I install modules, in particular DateTime?

# start by running Applications => Utilities => Terminal

	sudo perl -MCPAN -e shell
	install DateTime

... for more info, check out the CPAN docs at:
    http://search.cpan.org/dist/CPAN/lib/CPAN.pm


> 3 I can't find the Perl Package Manager on my system. Nor can my  
> launcher, or spotlight.

Sounds like ActiveState Perl either isn't installed, or isn't in your  
path.
Either way you'll have much more luck installing current versions of
modules via the standard CPAN shell.

> 4 I've got a workaround for this, but how do I tell Mac OS X to  
> open a .pl file with Perl? At present I'm running it in terminal  
> with a perl perrmoss.pl command.

There are a few options, depending on what you're after:

Easiest to explain if you start from a Terminal window.

1) Would assume your myfile.pl looks something like:

	#!/usr/bin/env perl

	use strict;
	use warnings;
	
	# ==> all the real stuff happens here

   (the important part here is having an initial #! line)

2) make the file executable

chmod +x myfile.pl

3) create the file association, if you haven't already

   # open a Finder window in the current directory
   open .

   # right-click on myfile.pl
   # choose "Open With", then "Other..." from the right-click context  
menu
   # browse to Applications => Utilitites
   # change the "Enable" selection from "Recommended Applications" to  
"All applications"
   # check the "Always Open With" checkbox
   # double-click on "Terminal"

4) double-click on myfile.pl from Finder and it should now run

OR

  i) Download and install the very handy Platypus app, which can be used
      to make a quick OS X app around your .pl script:
	http://www.sveinbjorn.org/platypus


Hope that helps get you on the right track.  For perl hints, you might
want to have a look (or try posting) on http://perlmonks.org/.

Cheers,
Stephen



More information about the Brisbane-pm mailing list