> I think a lot of people's approach, including mine, is to have OO Perl
> modules for all database access.  In my code (I use Mason), a web page
> only gets its data through calls like this:
>
> my $obj = NAIC::User->(DBH=>$dbh, EMAIL=>'[EMAIL PROTECTED]');
> $obj->load;
> my $groups_list = $obj->groups();
>
> That way any needed SQL changes, or even ports to a new database,
> don't have to be done everywhere in my code.

That's what I do too.  I suppose this could still be called "embedded SQL"
though.

You could put your SQL in a separate file, but I don't like that approach
because it doesn't seem like you would be changing SQL without changing the
other code very often.  Having your SQL right next to where it's being used
is convenient, and a HERE doc makes it easy to read.

- Perrin

Reply via email to