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

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Need a Custom or Prewritten Perl Program?: Throw Down The Gauntlet:
Multirecord Commit



Jan 26, 2000, 7:46 AM

Post #1 of 6 (42729 views)
Multirecord Commit Can't Post

I need to commit a mutirecord form.
I query based on a request id and retrieve info;', then scan barcodes and commit the data. On committing, update a few fields in addition to the scanned barcode.
I do it for one record using CGI-Perl.
Is there a better way to commit ten or more records at a time?


Jan 29, 2000, 9:21 AM

Post #2 of 6 (42729 views)
Re: Multirecord Commit [In reply to] Can't Post

Are you referring to 10 records to 10 separate data files? If so, I've copied today's "Daily Perl FAQ" for your consideration:

<BLOCKQUOTE><font size="1" face="Arial,Helvetica,sans serif">code:</font><HR>

How do I print to more than one file at once?

If you only have to do this once, you can do this:

for $fh (FH1, FH2, FH3) { print $fh "whatever\n" }

To connect up to one filehandle to several output filehandles, it's
easiest to use the tee(1) program if you have it, and let it take
care of the multiplexing:

open (FH, "| tee file1 file2 file3");

Or even:

# make STDOUT go to three files, plus original STDOUT
open (STDOUT, "| tee file1 file2 file3") or die "Teeing off: $!\n";
print "whatever\n" or die "Writing: $!\n";
close(STDOUT) or die "Closing: $!\n";

Otherwise you'll have to write your own multiplexing print function
-- or your own tee program -- or use Tom Christiansen's, at, which is
written in Perl and offers much greater functionality than the
stock version.</pre><HR></BLOCKQUOTE>

If this doesn't address your questions, could you please provide more information about what you're trying to do regarding record commitment?


Jan 31, 2000, 9:26 AM

Post #3 of 6 (42729 views)
Re: Multirecord Commit [In reply to] Can't Post

Thanks, but I'm not sure what would be appropriate and how to go about it.

Should I commit after each record or commit after say 10 records? for the following problem:
I query the database for a given request_id,which say retrieves 500 request_members. For each of the 500 records
a barcode entry is made. These entries have to be updated in the database.

I write the results of a single queried record to a file and then update one record at a time. When I update for a single record, I use a file to store the results of my query and one to store the update or errors. I'm using


Jan 31, 2000, 1:24 PM

Post #4 of 6 (42729 views)
Re: Multirecord Commit [In reply to] Can't Post

I really think you should be posting your questions in the programming help section with the moderator Scott. He is really good with CGI, and I am sure he can help you.

- Mike


Feb 1, 2000, 4:46 AM

Post #5 of 6 (42729 views)
Re: Multirecord Commit [In reply to] Can't Post


Unless I'm missing something key, it looks like a matter of 6 in 1, half a dozen in the other... not much different. The only thing I can see is that it may be more efficient to waiting to do several records at once (10 at a time) is that relevant modules would have already been loaded into the program, and that your records are in memory.

This looks like a personal preference decision -- Probably the best way to see what's more efficient (that is, what may be the better way to do it) is to try it both ways and do some benchmarking.

Good luck!


Feb 1, 2000, 5:07 AM

Post #6 of 6 (42729 views)
Re: Multirecord Commit [In reply to] Can't Post

Thankz guyz. I'm in the process of testing. I'll contact Scott if things don't look good.


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

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