[sf-perl] perl on a mac (this is going to take a major diversion)
darin_fisher at yahoo.com
Mon Nov 17 22:35:36 PST 2008
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!)
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
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:
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.
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
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
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the SanFrancisco-pm