|Embperl and DBIx::Recordset|
This introduction gives an overview how to use DBIx::Recordset together
with HTML::Embperl. Since there are only a few Embperl specific
things herein, it should be also usefull for non Embperl users.
It is often very difficult to layout and design the output of normal CGI
scripts, because you are dealing with
HTML-sourcecode which spans multiple prints, and it isn't possible to use
some sort of HTML-editor. Embperl takes a different approach to this problem.
With Embperl, you can build your HTML-pages
with any tool you like, and you can embed fragments of code directly
in the page. This makes it much easier for
non-programmers to use, because they are able to use
their usual tools and they see the fragments of code as normal text.
This indroduction will deal with the Perl Modules HTML::Embperl and
DBIx::Recordset, with a focus on database access.
In brief, the purpose of Embperl is to execute code that is
embedded in HTML-pages as the page is requested from the server.
There are two ways to do this with Embperl. The first way is to
embed the code between [- and -] tags. This will cause
Embperl to execute the code and remove it from the source before sending
the page. The second way is to use [+ and +] as the delimiter, in which case
the code will be executed and the result of the execution is send to the
browser in place of the code.
All database access is done via the module DBIx::Recordset, which simplifies
a lot of common tasks when accessing a database via DBI.