[sf-perl] perl on a mac (this is going to take a major diversion)

Kevin Frost biztos at mac.com
Tue Nov 18 02:37:58 PST 2008


A few more-or-less random notes on this topic from someone who's done  
Perl on Mac, Linux, and Windows for many years now; advice $FREE, take  
or leave it as you please.

1) Mac OS X is Unix.

It's not Linux, it's not a Unix derivative, it's real Unix.  We often  
forget this because the Mac Story is so much about UI spit, polish,  
and ease of use.  But under the hood it's fully certified Unix, and  
much of the culture of writing server software on a Mac is influenced  
by that.

2) Yes, there are (currently) no proper all-in-one IDE's for Perl on  
OS X.

If you really can't live without a complete Visual Studio style IDE  
then you should just run a VM on your Mac.  However, you could also  
look at this as an opportunity:  a lot of people create a lot of  
awesome Perl on Macs and are really happy about it; most of these  
people have done at least some Perl development on Windows and like it  
on Mac better; and there are, not coincidentally, a lot of Mac tools  
that cater to this mentality.  Maybe it's collective insanity, or  
maybe there's something behind it.

Or you can run Eclipse or Komodo, both of which work fine on a Mac, if  
that's your thing.  It's not mine, so I don't have any useful advice  
on integration except to say they don't feel "Mac-like" (nor do they  
try).

http://www.eclipse.org/

http://www.epic-ide.org/

http://www.activestate.com/Products/komodo_ide/index.mhtml

(Yes, I've used both; no offense but it's just not how I like to work,  
I will wear myself out making good unit tests but I basically never  
use the debugger.)

3) You may wish to run a VM anyway.

My personal tool chain usually includes a VM running some flavor of  
Linux, sharing a folder with OS X, and very often another VM running  
Windows for browser testing.  This is a bit of a pain to set up (on  
any host OS) but in the end it can be very efficient, at least if your  
software is going to be deployed on Linux or used by Windows users.

You could apply the same logic to other parts of your tool chain if  
necessary.  Both VMWare Fusion and Parallels Desktop are wonderful,  
full-featured virtualization solutions for Intel Macs.

http://www.vmware.com/products/fusion/

http://www.parallels.com/products/desktop/

4) There are some interesting IDE type things for Mac after all.

If you are happier in an IDE than in a shell, check out Coda.

http://www.panic.com/coda/

I don't think it's used by Perl developers much, but it has a lot of  
potential.  In my experience most Perl coders working on Macs actually  
don't want a fully-integrated IDE; but if that's what you really want,  
and you're going to spend a bunch of time on the effort anyway, I bet  
you could get locally famous by helping the Panic folks make Coda more  
Perl-friendly.

5) AFAIK IMHO FWIW TextMate is the s**t, YMMV.

Being a vim user who's never liked EmacsOS, I'm not afraid of  
religious wars. :-)

So: TextMate is my favorite text editor, ever.  The one thing I hate  
about it is the complete lack of acceptable printing support.  What I  
love about it is everything else, especially the comprehensive shell  
integration that even lets me get around the printing problem (in a  
shockingly geeky way, but whatever).

I'll admit much of this love is just about a UI paradigm that feels  
"right" to me, but it's also a very happy thing for everyone if your  
trigger finger twitches above the perltidy macro you set up; and  
pretty much anything you can do with a Unix shell, including "preview  
as a CGI in my favorite web browser," is just a hotkey away once you  
get used to the "bundle" concept.  Web browsing a la Safari is tightly  
integrated with OS X, and TextMate will happily show program output in  
a browser.

If you want a GUI text editor and a flexible tool chain and are happy  
in a Unix shell you really should check it out:

http://macromates.com/

http://biztos.blogspot.com/2008/06/printing-with-textmate-vim-and-friends.html

However, bear in mind that the TextMate world is very much geared  
towards do-it-yourself types.... so there are tons of freebies and a  
lot of free support, but we're all trying to build the "perfect  
editing environment for ME ME ME ME."

6) Apache isn't your only option.

If you're writing complex mod_perl systems then it probably is, but if  
you're just doing CGI then I recommend lighttpd, which is very, um,  
light, and easy to configure.  I use this for developing small, CGI- 
based web sites on my Macs.

http://www.lighttpd.net/

I just checked my config file and it's 28 lines plus comments for a  
fully-functioning CGI-based stack running locally.

There are others of course but I really think this one hits the sweet  
spot for offline web development. There's more than one way to do it.  
(TM)

7) The new is always unfamiliar; don't blame the new.

I used Windows for a long, long time, and was very happy with my tool  
chain there.  I'm happier now on Macs, and every once in a while I  
have to jump back to Windows, and I find it maddening.

I often start thinking "why couldn't they just...." -- and then I  
remember that, yes, once you get used to it and set it up right you  
can do just about anything you need in Windows just like you can in a  
Mac, but it's no longer familiar to me.

I'm a happy Mac partisan and just like the next guy I can list reasons  
why "my platform" is better than "some other platform" -- but once you  
get into the specifics, at least for software development it's  
objectively the case that smart people happily make great software on  
a bunch of different platforms.

The one you don't understand at the moment will always feel vaguely  
wrong, until you get used to it and it doesn't.  But then some other  
platform will feel vaguely wrong and you will be tempted to jump to  
the exact same (wrong) conclusion about that one.

8) $LARA ++;

I second/third that sentiment.  Awesome explanation!

Lara, if you don't already teach engineering courses you should  
seriously consider it.  If you do, I want to hire your students some  
day. :-)


[ the palaver is finished ]

-- frosty


On Nov 17, 2008, at 11:08 PM, Darin Fisher wrote:

> Thanks Mike!
>
> I didn't want to get into a "PC" discussion, so...forget it!
>
> Back to the original discussion.
>
> None the less, this is a newbie discussion and he has a very valid  
> question (even though it actually has nothing to do with Perl :) ).
>
> This has everything to do with OS configuration and (again, thank  
> you Lara for a great detailed description).
> (and i'm actually kind of embarrassed that i don't know this one :( )
>
> So..., if you still haven't received your answer.  Drop one of us an  
> email and I'm sure we can fix (figure out) the problem (solution)  
> for you!
>
> -Darin
>
>
> Not a shred of evidence exists in favor of the idea that life is  
> serious.
> - Brendan Gill
>
>
> From: Michael Friedman <friedman at highwire.stanford.edu>
> To: San Francisco Perl Mongers User Group <sanfrancisco-pm at pm.org>
> Sent: Monday, November 17, 2008 10:51:32 PM
> Subject: Re: [sf-perl] perl on a mac (this is going to take a major  
> diversion)
>
> I meant no offense. I recognize he's a newbie to the Mac, but not to  
> perl, and tried to offer only constructive advice. It's just the  
> first line that is snarky and I probably should've deleted.
>
> Apologies, to Walt and the list, if I was out of line. I wasn't  
> intending a smack-down; just to point out that perhaps he's asking  
> the wrong question.
>
> -- Mike
>
> On Nov 17, 2008, at 10:35 PM, Darin Fisher wrote:
>
> > Sorry Mike but it's a lot more simple than that!
> >
> > This is a very experienced list and most of us avoid getting into  
> "religious" discussions.
> > But, since I stuck my neck out, I will stay in it...
> >
> > The original question is from an obvious "newbie" (and seemingly a  
> pretty smart one from I can tell).
> > A lot of us on this specific list have multiple disciplines and  
> the only reason I spoke when i did was when i couldn't stand it  
> anymore.
> > But your argument is just too inviting to old-school smack.
> >
> > And given that, try to remember when you were a newbie, we all  
> were at one point!
> >
> > (to everyone else, sorry for the soapbox!)
> >
> > -Darin
> >
> >
> > Not a shred of evidence exists in favor of the idea that life is  
> serious.
> > - Brendan Gill
> >
> >
> > From: Michael Friedman <friedman at highwire.stanford.edu>
> > To: Walt Sanders <wsanders at cruzio.com>; San Francisco Perl Mongers  
> User Group <sanfrancisco-pm at pm.org>
> > Sent: Monday, November 17, 2008 10:08:09 PM
> > Subject: Re: [sf-perl] perl on a mac
> >
> > Walt,
> >
> > Maybe I'm just cranky today or maybe I'm too partisan, but I feel  
> I have to reply to "what a mess to go through for a supposedly  
> polished OS".
> >
> > Mac OS X does exactly what every other OS does when given the  
> input and output you've shown: if you run a perl script on the  
> command-line, and it uses print statements, it prints the output in  
> that same window. Whether the output happens to be text, HTML, or  
> binary data doesn't matter at all. Print is print.
> >
> > It sounds to me like on Windows you were running perl not from the  
> command-line but from a fancy IDE which would recognize that the  
> output was HTML and read it for you, copy it to a temporary file,  
> and open that file in your browser. This behavior sounds great, but  
> it's unrelated to the operating system (and perl itself, for that  
> matter). It's entirely a function of whatever IDE you were using  
> that just happened to run on Windows.
> >
> > To get the same behavior on OS X (or any other unix variant), you  
> can do what Alex Feinberg suggested seven days ago:
> >    perl myscript.pl > /tmp/file.html && open /tmp/file.html
> >
> > which tells perl to run your script (so instead of "myscript.pl"  
> you'd use the path to your CGI script), take the output and write it  
> to a file instead of to the screen, and then open that file. (The  
> open command sees the extension ".html" and knows to open the file  
> in your default browser.) If this doesn't work, there are only a  
> couple of reasons:
> >
> > 1. "perl" isn't in your path. Use wherever you installed perl  
> instead. The built-in version is /usr/bin/perl.
> >
> > 2. Your script's output didn't properly parse as HTML. That can  
> cause a blank page to appear in the browser. In this case, you can  
> go read the temp file directly to see what happened or use "View  
> Source" on the blank browser page.
> >
> > If you are using BBEdit or TextMate or Eclipse or another heavy- 
> duty OS X text editor it should be easy to set this up as a menu  
> option within the editor.
> >
> > Setting up apache to use something more than the default  
> configuration is never an easy task, even on Windows. It's "messy"  
> like tuning a race car is messy -- it's a really complicated engine  
> because there's more power under the hood than you could possibly  
> use on the streets. But again, that's a "feature" of apache, not of  
> the OS.
> >
> > So, it seems to me that what you are really looking for is an IDE  
> that has support for debugging CGI scripts internally. One that just  
> happens to run on Mac OS X.
> >
> > I haven't used it personally, but I believe that this is available  
> in ActiveState's Komodo IDE, which runs on Windows, Mac OS X, or  
> Linux. You can find out more and download a demo from their website:
> >    http://www.activestate.com/Products/komodo_ide/index.mhtml
> >
> > You should also check to see if the IDE you currently use on  
> Windows offers a Mac version. Some do.
> >
> >
> > Anyway, I wish you the best of luck with your new Mac! I've been  
> programming perl on OS X for years now and have found it to be a  
> very good developer platform. The command-line shell takes some  
> getting used to if you've only used Windows's limited command shell,  
> but it's a great tool once you understand it.
> >
> > -- Mike Friedman
> >
> > PS - On a non-perl note, I highly recommend Take Control eBooks if  
> you want to learn more about your Mac.
> >    http://www.takecontrolbooks.com/catalog.html
> >
> > They don't have one about the unix underpinnings or using the  
> command-line, so you may also want to check out one of the "Unix on  
> Mac OS X" books such as O'Reilly's _Learning Unix for Mac OS X  
> Tiger_. There are others, and that one's a little outdated, but it's  
> still almost entirely relevant for Leopard.
> >
> >
> > On Nov 17, 2008, at 6:30 PM, Walt Sanders wrote:
> >
> > > Lara, I surely hope you had all this in a file to grab and  
> send?!  My god what a mess to go through for a supposedly polished  
> OS.  And why doesn't Apple have this already configured, I'm  
> wondering.
> > >
> > > Gotta go now and I'm away tomorrow, but will then try to digest  
> your instructions and give it a try.  I am at the point where I was  
> about to start advertising for a fixer to take my machine and make  
> it work.  But, this is new hope.  Many, many thanks and I'll report  
> back.  Walt.
> > >
> > >
> > >
> > > On Monday, at , Lara Ortiz de Montellano wrote:
> > >
> > >> 1. Re: perl on a mac (Walt Sanders)
> > > _______________________________________________
> > > SanFrancisco-pm mailing list
> > > SanFrancisco-pm at pm.org
> > > http://mail.pm.org/mailman/listinfo/sanfrancisco-pm
> >
> >  
> ---------------------------------------------------------------------
> > Michael Friedman                    HighWire Press
> > Phone: 650-725-1974                  Stanford University
> > FAX:  270-721-8034                  <friedman at highwire.stanford.edu>
> >  
> ---------------------------------------------------------------------
> >
> >
> > _______________________________________________
> > SanFrancisco-pm mailing list
> > SanFrancisco-pm at pm.org
> > http://mail.pm.org/mailman/listinfo/sanfrancisco-pm
> > _______________________________________________
> > SanFrancisco-pm mailing list
> > SanFrancisco-pm at pm.org
> > http://mail.pm.org/mailman/listinfo/sanfrancisco-pm
>
> ---------------------------------------------------------------------
> Michael Friedman                    HighWire Press
> Phone: 650-725-1974                  Stanford University
> FAX:  270-721-8034                  <friedman at highwire.stanford.edu>
> ---------------------------------------------------------------------
>
>
> _______________________________________________
> SanFrancisco-pm mailing list
> SanFrancisco-pm at pm.org
> http://mail.pm.org/mailman/listinfo/sanfrancisco-pm
> _______________________________________________
> SanFrancisco-pm mailing list
> SanFrancisco-pm at pm.org
> http://mail.pm.org/mailman/listinfo/sanfrancisco-pm

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/sanfrancisco-pm/attachments/20081118/e30d2f91/attachment-0001.html>


More information about the SanFrancisco-pm mailing list