"Steve" <stevem_@nogood.com> wrote in message
news:...
> On 08/23/2010 03:34 PM, Paul E. Schoen wrote:
> <snip>
>
>> I rewrote the second.pl script as follows:
>>
>> #!/usr/bin/perl
>> use strict;
>> use warnings;
>> use CGI;
>> my $query= new CGI;
>> print $query->header;
>> print "\nStarting\n\n";
>> open my $out, '>', "output.txt" or die "File error: $!";
>> print $out $query->header;
>> print $out "\nHello, World.\n";
>> close $out;
>> # print $query->header;
>> print "\nFinished!\n";
>>
>> Running it on Telnet shows both headers and their text. But if run on
>> the browser it only shows "Starting". Probably just shows how much I
>> need to learn!
>>
>
> Probably because of an error trying to open that file.
Actually, running it in Telnet produces both headers and text, and the
"output.txt" file is updated. I wanted the browser to show "Starting" and
then "Finished" after the file had been written. It does the same thing as
edited above, without the second header. I thought it should show both lines
in the browser. So, how does the browser know that the text it is reading on
stdout has "finished"? Would it work if it actually generated HTML?
>> Now I just need to get the log-on setup for the actual live Sierra Club
>> site.
>>
>> Thanks a lot!
>>
>> Paul
>
> You're welcome.
>
> You've outlined a massive amount of work for yourself, but as long as
> you're having fun.
Yes, I have fun once I learn enough to get at least a simple script working.
Now I have made a form which POSTs data to a mailer.pl script I got from
http://www.jmarshall.com/easy/cgi/ and modified it to work with my sendmail
application on the Smartnet server. It works OK except that the ReplyTo
appears as "nobody". The perl script that invokes it is:
$mailprog= "/usr/bin/sendmail" ;
$recipient= "paul\@peschoen.com" ; # make sure to \ escape the @
# Get the CGI input variables
%in= &getcgivars ;
open(MAIL, "|$mailprog $recipient")
|| &HTMLdie("Couldn't send the mail (couldn't run $mailprog).") ;
# Print the header information
$ENV{'HTTP_REFERER'} || ($ENV{'HTTP_REFERER'}= "www.peschoen.com") ;
print MAIL "Subject: Form data from the Web\n\n",
"The following data was entered at $ENV{'HTTP_REFERER'}:\n\n" ;
There is another form emailer that can be called from the dreamhost server
http://formmail.dreamhost.com/cgi-bin/formmail.cgi and it uses what I set as
"email" in the form data.
I have installed an editor
http://www.indigostar.com/perledit.php that seems
pretty good, and I've made it my default for perl script files. It can even
edit the remote file directly using FTP.
OK, my fun is done for the day. But here is an outline of what I intend to
do:
1. Have an HTML document that will read the contents of another HTML file
which contains dates, titles, and descriptions of events. It should list
these entries in order of date, and possibly delete events that are older
than the present date, or put them in a "Past Events" file.
2, Have a form that will allow a user to enter a new event, and POST this to
a CGI script that will format the data and add it to the file. Then the
updated file should appear in the document. There should be some sort of
password protection and also a check for duplicate entries, although
duplicate dates may be allowed.
3. The events list will appear in the home page
www.smart.net/~pstech/SCGBG,
which will remain mostly static except for changes I will make. The
important thing is to have other members be able to update events as needed.
4. All changes to the list will be automatically emailed to me so I know
what's going on and who is doing what.
I think I can do this! But that will be for another day...
Thanks for putting up with a newbie.
Paul and Muttley
www.peschoen.com
www.muttleydog.com