At 11:15 AM -0700 5/17/01, Tom Sackett wrote:
>I've run into the same problems recently.
>
>Here's my suggestion:
>1. In BBEdit, save the file as a Unix text file.
>2. When uploading the file from fetch, upload it as raw data.
>3. Set the files permissions from a command line. I think they should be 755.
>
>The reason why you need to upload the file as raw data instead of text is
>that the FTP transfer will try to convert text files from Mac to Unix line
>endings. If the file already is in Unix format, it may get screwed up.
>

I wouldn't do it this way. Save on your Mac with Mac line endings (<= 
OS 9.1). Save with UNIX line endings only if you want to execute in 
OS X's UNIX environment.

When you upload a text file, your FTP program will do the line ending 
translation for you. Fetch, Anarchy, Interarchy, Transmit, and other 
Mac FTP clients all do this without problems, provided you upload as 
*text*, not "raw data". If you use BBEdit's Save to FTP server, it 
will also do the right thing with line ending translation, if the 
file you are uploading is a text file with Mac line endings.

If the file is already in UNIX format, BBEdit treats it as a binary 
("raw data") and does not translate line endings. To avoid problems, 
don't save locally with UNIX line endings.

To the original poster, webkat <[EMAIL PROTECTED]>,

>I use Fetch to upload.  I have been going to Remote & Set Permissions after
>I have the file uploaded.  Should I set permissions as owner RWE, group R-E
>& everyone R-E?

Yes.

>Well, mine is #!/usr/local/bin/perl

Correct, assuming your ISP gave you that path. And note that Mac OS 
doesn't use that line to locate MacPerl, so just leave it there if 
you save as MacPerl CGI for local CGI execution.

But the best thing would be to use this line:

#!/usr/local/bin/perl  -w

The -w switches on Perl's warnings, alerting the syntax scolds to 
hover over your shoulder ready to rap your knuckles at every 
transgression. Your long term survival as a programmer depends on 
learning that these pests are your allies, because they provide 
information so that mistakes become your welcomed friends. Every 
script you write should start out with warnings enabled, and except 
in rare circumstances, strive to keep warnings enabled even when the 
script is deployed in the production environment. The -w switch is 
just the first of several best practices for programming...

>Back to BBEdit & changed to saving as UNIX.  However, when I looked at "show
>invisibles", it clearly showed the returns.  What do I do??
>Does anyone else use BBEdit to write perl?
>Should I use MacPerl?  If I use MacPerl, where do I set the lines for UNIX
>machine?

See above re not saving as UNIX.

Many Perl programmers work on Macs, and use BBEdit and MacPerl for a 
development environment. Until I shifted to OS X, I wrote all my code 
in BBEdit, using its integration with MacPerl for syntax checking and 
some testing. If it was a CGI, I would use my Mac's web sharing and a 
shareware server like Quid Pro Quo with MacPerl to simulate the 
web/CGI environment. The latter is also handy as a GUI for programs 
that aren't for the Internet.

Now, with OS X, I code, syntax-check, and test in BBEdit; test and 
execute with the OS X Terminal's command line; and use real web/CGI 
with UNIX Apache, Perl, PHP, mySQL, etc. For Just Another Small-Town 
Perl Hacker, this is sweet.

After development under Mac, nearly all of my stuff all ends up on 
UNIX/Linux or NT, and I love being able to deploy the exact same 
scripts in all three environments. Others might have more elaborate 
setups, but for me the chief tool for Perl development is BBEdit, 
with its [Mac]Perl integration and FTP capabilities. This applies in 
both OS 8/9.x and OS X. BBEdit has other powers as well, like great 
support for HTML/XML when you have to write it by hand.

So, yes, some folks use BBEdit to write Perl.

1;

Reply via email to