[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] Porting MacPerl to Unix



BB wrote:

>I am having a problem with taking a cgi script such as FormMail.pl and
>putting it on a Unix machine.  I have asked the server my page is on for
>all the right paths to the mail program and perl program and also
>renames it to FormMail.cgi which they say is best.  Fine, I did all
>that.  But the problem is , it's not working.  I know others out there
>have ahd the same exact problem.  I saw one solution which said to save
>it in a plain text format and upload that....I did that and it still
>didnt work.
>
>Can someone please shed some light on this matter?  I am not a
>programmer by any means so can someone please write a conversion program
>for this??? :-)

And Tom Ritchford responded:

>It might well be due to the carriage return/line feed problem...
>here's a script that might be helpful for you...

[Nice script, Tom]

But golly, are you sure something needs to be converted? ;-)

You haven't said what's "not working" so let's assume you get a generic
error message from the server when you click your HTML form's "submit"
button.

While it ain't the latest thing, I still use FormMail.pl fairly frequently
(version = 1.6), making changes and adding subroutines using BBEdit on my
Mac, testing code snippets with MacPerl, then uploading to server sites
running Perl (4 or 5) on UNIX, and ... it works fine [thanks Matt!].

Here's my checklist for testing HTML form CGIs:

1. Work on script in BBEdit or some other straight text editor, not a word
processor;
2. Rename script with suffix '.cgi' (no quotes);
3. Check paths on host server for Perl and for sendmail;
4. Upload script as text, not binary/raw data -- and make sure your FTP
client doesn't add another suffix (e.g., '.txt' or '.bin');
5. Set permissions of script to world readable & executable;
6. Make sure <FORM> attribute
ACTION="http://host_server.domain/path_to_script/script.cgi" is correct as
far as path and naming (capitalization counts on UNIX);
7. Start testing with a _very_ simple HTML form;
8. Make sure to put the correct hidden fields into the form (FormMail takes
recipient, redirect, subject, etc.);
9. If using someone else's script, start testing with no modifications
(except necessary setup);
10. Make _one_ change at a time, save/upload, & test;
11. Document (# Comment) all changes in the script.

Since you didn't mention it, my guess is that #5 might be the culprit.
Using Fetch, the Mac FTP client, permissions are set under the "Remote"
menu (select the uploaded script in Fetch's file list window first) -- just
make sure "Everyone" is able to Read and Execute ("Owner" should be able to
Read, Write, & Execute).

Hope this helps. There's always checking with the author: FormMail.pl comes
from Matt's CGI Archive, at http://www.worldwidemart.com/scripts/.

Incidentally, this caught my attention tonight 'cause I've just finished a
little subroutine for FormMail that allows customizing the field labels in
the returned data (e.g., Name = Bruce -- the label here is "Name = ") in
the email message generated by the script. Turning the field labels on/off
and substituting other field labels for the names of the HTML input widgets
in the form lets my clients get return data that is more suited to their
particular uses, while sticking with a reliable & well-tested main script.

If anyone's interested, email me (this isn't strictly a MacPerl-specific
question...  ;-)), and I'll send the subroutine and instructions.

Good luck!


- Bruce

~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Bruce Van Allen
bva@cruzio.com
408/429-1688
P.O. Box 839
Santa Cruz, CA  95061



***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch