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

Re: [MacPerl] Database to CGI



Hi Allan,

Actually, doing a simple database for this isn't more work (it might even 
be less!) and it will be *much* faster for your audience.

I just started using the mac port of Storable.pm for databases. Very 
cool. Here's a sample using Storable's syntax:

#!perl -w
use strict;
use Storable;

my $JobsDB = "jobs.db"; 
my %jobs;

$jobs{'0001'} = { 'desc' => 'Corporate Database Spammer',
							'catg' => 'Information Technology',
							'city' => 'Timbuktu',
							'hot' => 'True',
							'detl' => 'Perl experience required.' };

store (\%jobs, "$JobsDB");

#Test that data!
my $jobsref = retrieve($JobsDB);
print "jobsref 0001 desc = $jobsref->{'0001'}{'desc'}\n";
print "jobsref 0001 catg = $jobsref->{'0001'}{'catg'}\n";
print "jobsref 0001 city = $jobsref->{'0001'}{'city'}\n";
print "jobsref 0001 hot = $jobsref->{'0001'}{'hot'}\n";
print "jobsref 0001 detl = $jobsref->{'0001'}{'detl'}\n";

unlink $JobsDB;
exit();

It seems to work very well. You'll need to get the mac version of cpan to 
install Storable. Don't decompress the archive with some other app, 
though. Just drop it on the "installme.plx" droplet - I ran into some 
trouble with that yesterday.

You can get both packages from:
http://www.perl.com/CPAN-local/authors/id/CNANDOR/

I love this data storage method! Thanks Pudge!

Good luck,
Troy

Allan Greenier, agreenier@snet.net thus spoke on 3/25/99 6:47 AM:
>Greetings,
>This is just a trolling for any general advice one of you might offer.
>I have a Filemaker Pro database.When you pick a MacModel from a pop-up
>menu, it returns it's memory configuration. I want to make a Perl CGI to
>mimic the database on the Web. I thought I would just save a flat file
>from the Database and have perl take the Pop-up choice and search line
>by line through the flat file until it finds the choice and then return
>an HTML table with the results.
>
>I thought the job was too simple to need a Perl database solution.
>
>any advice??



_______________________________
Troy Davis
Creator of Low, Rumbly Things
Glyss, Glyssmusik
http://www.glyss.com/

Goodness without wisdom always accomplishes evil.
- Michael Valentine Smith, Stranger in a Strange Land


===== Want to unsubscribe from this list?
===== Send mail with body "unsubscribe" to macperl-request@macperl.org