* Philip Mak ([EMAIL PROTECTED]) [010613 18:21]:
> Hello all,
>
> I've been experimenting with a programming technique idea I had that I
> call "Object Oriented Databases". The goal of the technique is to make
> programming database driven websites easier by allowing the website code
> (I use Apache::ASP, which is built on mod_perl) to access the database
> contents as objects rather than having to write SQL statements. (The SQL
> statements are in the .pm files that define the objects' methods.)
Hi Philip,
You might also be interested in SPOPS (Simple Perl Object Persistence
with Security). Nothing illustrates the point like code, so here's
some sample code. The file 'object_info.perl' contains configuration
information for the objects 'author' and 'fanfics'.
use strict;
use SPOPS::Initialize;
SPOPS::Initialize->process({ filename => 'object_info.perl' });
my $author_list = Fanfics->fetch_group({ order => 'name' });
foreach my $author ( @{ $author_list }) {
my $fanfics_list = $author->fanfics;
foreach my $fanfic ( @{ $fanfic_list } ) {
print <<<LINK;
<a href="$fanfic->{handle}.html">$fanfic->{title}</a> by
<a href="mailto:$author->{email}">
$author->{name}</a><br>
LINK
}
}
You could just as easily reverse the list and fill $fanfics_list
first, then for each fanfics find its author.
One of the best points is that you don't even need to modify your
database schema -- just create configuration information for the
object, run SPOPS::Initialize on it and the necessary classes are
created for you behind the scenes.
SPOPS also makes this trivial to move this data from one datastore
(MySQL) to another (PostgreSQL, or any other supported database) just
by modifying a line in the configuration.
The next version of SPOPS (0.41) will also support iterators which
will make the above code much more efficient memory-wise. (I just
finished writing the code while at YAPC North America -- a very
fertile environment!)
If you're interested, SPOPS is on CPAN, and you can join the
openinteract-help or -dev mailing lists (which provide support and
discussion for SPOPS) at:
http://sourceforge.net/mail/?group_id=16810
Hope this helps!
Chris
--
Chris Winters ([EMAIL PROTECTED])
Building enterprise-capable snack solutions since 1988.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]