UBB.Dev
Posted By: Sal Collaziano How would I do this with Perl/CGI? - 10/23/2001 12:24 AM
Hi all. I'm just beginning to learn Perl/CGI. I haven't made any scripts yet, but I'd like my first to do this (could you please tell me if this is possible?):

I need to make a list of all travel agents so that a person could search for the agents in a particular zip code. What I'd like to do is develop a form where an administrator can enter in a name, address, company, etc. From here, a user could enter a zip code to pull up this information.

Now. Is it possible, once the first .cgi or .html is saved, to have the script APPEND that file with new information as it is received? Say several agents are in one zip code. I need to make something where each time a new agent is entered, this information is added to the rest..

Any advice would really be appreciated...

Thank you in advance

Sal Collaziano

P.S. If this is something easy to do and someone would like to make an offer to build it for me, that would be cool.
Posted By: Matt Jacob Re: How would I do this with Perl/CGI? - 10/23/2001 1:18 AM
You could run something like a database, which is probably pretty complex to code. Or, as I understand it, you could do something pretty simple. It involves opening the file, adding your data, and then closing the file. The Perl gurus will have to back me up on this one, but that's the gist of it.
Posted By: adam Re: How would I do this with Perl/CGI? - 10/23/2001 1:31 AM
correct me if im wrong...

open(FILE, '>> file');
info to append here
close(FILE);

again, correct me if im wrong..
Posted By: Calvin Re: How would I do this with Perl/CGI? - 10/23/2001 3:00 AM
open (FILE, ">>/home/file/file.txt") or die Cannot open damn file.
print FILE "STUFF GOES HEREn!;
close (FILE);
chmod(0755, "/home/file/file.txt");

wink
Posted By: Sal Collaziano Re: How would I do this with Perl/CGI? - 10/23/2001 4:45 AM
Is this the same way the UBB works?

It opens the .cgi file
Adds to the .cgi file
Then closes the .cgi file

That seems pretty simply. Am I understanding correctly?
Posted By: Calvin Re: How would I do this with Perl/CGI? - 10/23/2001 6:28 AM
I'm not sure if UBB uses that way, but that's the way I do it in my perl scripts.
Posted By: LK Re: How would I do this with Perl/CGI? - 10/25/2001 2:32 PM
Quote
quote:
It's not gonna work.

open (FILE, ">>/home/file/file.txt") or die "Cannot open damn file.";
flock(FILE, LOCK_EX);
print FILE qq!STUFF GOES HEREn!;
flock(FILE, LOCK_UN);
close (FILE);
chmod(0755, "/home/file/file.txt");

[ 10-25-2001: Message edited by: LK ]
Posted By: Calvin Re: How would I do this with Perl/CGI? - 10/25/2001 9:35 PM
Yeah, yeah. tipsy
Posted By: Sal Collaziano Re: How would I do this with Perl/CGI? - 10/25/2001 10:46 PM
Thanks. smile I'll have to save that script so that once I know how to program, I can find out what it means! tipsy It'll happen. smile
Posted By: Burak Re: How would I do this with Perl/CGI? - 10/26/2001 1:03 PM
if you dont know Perl, you must get a Perl book...
Posted By: tackaberry Re: How would I do this with Perl/CGI? - 10/26/2001 9:57 PM
And if you're going to buy a book, start off with O'Reilly's Llama book.

-Tacks
Posted By: Sal Collaziano Re: How would I do this with Perl/CGI? - 10/26/2001 9:58 PM
I just bought one. It's called, "Perl and CGI for the World Wide Web: Second Edition" by Elizabeth Castro.. Also, I bought some multimedia package which I'll get into as soon as I'm done with the book. smile
Posted By: Matt Jacob Re: How would I do this with Perl/CGI? - 10/27/2001 12:38 AM
That book is [Linked Image]. wink
© UBB.Developers