CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Need a Custom or Prewritten Perl Program?: I need a program that...:
Web broadcast e-mail perl script

 



goosenoose
Novice

Aug 20, 2010, 10:40 AM

Post #1 of 10 (4800 views)
Web broadcast e-mail perl script Can't Post

Hi,

I've been assigned as the webmaster for my AFROTC detachment at New Mexico State U. I've been able to hold my own managing the existing HTML of the site however I have nil experience with scripting/coding and our perl script that handles our e-mail broadcast system recently has gone down.

I've been in communication with our the IT guys with the university and they've advised they've fixed issues with some modules that weren't installed and were blocking our script's functionality. I'm still getting errors when running the e-mail script though, unfortunately. (see here: http://web.nmsu.edu/~afrotc/cgi-bin/cadet_email.pl

this is the error that I receive in case the vpn doesn't let you guys access it...

Quote
Sorry, cannot open /home/canto8/~afrotc/public_html/tmp2/: No such file or directory
Cannot close /home/canto8/~afrotc/public_html/tmp2/: Bad file descriptor


I thought it might be a simple fix with regard to creating/setting permissions of a public_html/tmp2 directory. No dice.

I've attached the perl script for our e-mail system here.. My request is more of a troubleshooting more than anything else, but if someone happens to append any improvements on what we have, we'd be most grateful.

Sincerely,

C/ Robin Deguzman


(This post was edited by goosenoose on Aug 20, 2010, 12:17 PM)
Attachments: cadet_email.pl (2.79 KB)


Zhris
Enthusiast

Aug 20, 2010, 12:15 PM

Post #2 of 10 (4788 views)
Re: [goosenoose] Web broadcast e-mail perl script [In reply to] Can't Post

Hey,


Quote
I've attached the perl script for our e-mail system here


I think you forgot to include your script?

Chris


goosenoose
Novice

Aug 20, 2010, 12:18 PM

Post #3 of 10 (4785 views)
Re: [Zhris] Web broadcast e-mail perl script [In reply to] Can't Post

Oh snap! Thanks!

edit: It's up now!


(This post was edited by goosenoose on Aug 20, 2010, 12:18 PM)


Zhris
Enthusiast

Aug 20, 2010, 2:28 PM

Post #4 of 10 (4780 views)
Re: [goosenoose] Web broadcast e-mail perl script [In reply to] Can't Post

Hey,

I haven't tested your script (would have to create the HTML form etc), but the first thing that comes to mind is that "/home/canto8/~afrotc/public_html/tmp2/" isn't a valid path hence why it is unable to open the file. Are you sure this is the correct path, i.e. the tmp2 directory exists?

Chris


(This post was edited by Zhris on Aug 20, 2010, 2:30 PM)


goosenoose
Novice

Aug 20, 2010, 4:10 PM

Post #5 of 10 (4771 views)
Re: [Zhris] Web broadcast e-mail perl script [In reply to] Can't Post

it exists; however i'm not sure if it's configured correctly. i.e. permissions for it are set to 0755.


Zhris
Enthusiast

Aug 20, 2010, 4:35 PM

Post #6 of 10 (4765 views)
Re: [goosenoose] Web broadcast e-mail perl script [In reply to] Can't Post

Your errors do not suggest that your permissions are incorrectly set, saying that, I may be wrong. Ill have a look around, but at this time I don't know what else to suggest. Hopefully another user may be able to aid you. If it is possible, could you provide your HTML form, then ill be able to quickly test your script. If your script runs fine for me, ill be able to inform you of my personal configuration.

Chris


goosenoose
Novice

Aug 20, 2010, 4:44 PM

Post #7 of 10 (4761 views)
Re: [Zhris] Web broadcast e-mail perl script [In reply to] Can't Post

Sure! one sec. I just need to remove the personal information from it.


goosenoose
Novice

Aug 20, 2010, 4:52 PM

Post #8 of 10 (4760 views)
Re: [goosenoose] Web broadcast e-mail perl script [In reply to] Can't Post

Hi Chris,

I've attached the html page that uses the script

Thanks for all your help so far by the way; I've been floundering in admonitions and brimstone from my comrades for this, ha.

-r
Attachments: safe_cadet_email.html (5.92 KB)


Zhris
Enthusiast

Aug 20, 2010, 5:20 PM

Post #9 of 10 (4753 views)
Re: [goosenoose] Web broadcast e-mail perl script [In reply to] Can't Post

Thank you,

Excuse me if you recieved a couple of emails.

I ran your script with no problems...
- I use a linux shared web host (1and1).
- Permissions of the pl script were "755".
- Permissions of the directory where the file is being uploaded to were "644".
- I ran the script from the same directory as the html page, using the Cwd module to automatically get the path for me, so that I didn't have to explicitly write it (my $FILE = getcwd().'/';).

On your side, your script runs with no problems, your errors relate to the opening of the file whilst uploading. I'm still wondering if its a path issue. If it were a permissions issue, you would recieve the error "Permission denied".

Chris


(This post was edited by Zhris on Aug 20, 2010, 5:27 PM)


FishMonger
Veteran / Moderator

Aug 22, 2010, 8:49 AM

Post #10 of 10 (4728 views)
Re: [goosenoose] Web broadcast e-mail perl script [In reply to] Can't Post

There are lots of problems with that code, but lets start by focusing on the "cannot open" error.


Code
my $FILE = "/home/canto8/~afrotc/public_html/tmp2/"; 
...
...
open(UPLOAD, "+>$FILE/$name") ...


Part of your problem is that you have an extra / in the path. Note the one terminating the path in the $FILE assignment and the one used in the open call. Remove the one in the $FILE assignment.

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives