I did some work today with DBIx::Class and Koha, and got opac-account.pl partially using it.
You can see the schema here and I had to make a few changes to C4::Context, and a few to opac-account.pl.
Here is what they were.
diff --cc C4/Context.pm index 7ba57fb,4dab9a9..cafc0ca --- a/C4/Context.pm +++ b/C4/Context.pm @@@ -18,6 -18,6 +18,8 @@@ package C4::Context
use strict; use warnings; ++use Koha::Schema; ++ use vars qw($VERSION $AUTOLOAD $context @context_stack);
BEGIN {
@@@ -191,6 -191,6 +193,27 @@@ $context = undef;        # Initially, n
=cut
++sub schema {
++    my $self = shift;
++    my $db_driver;
++    if ($context->config("db_scheme")){
++        $db_driver=db_scheme2dbi($context->config("db_scheme"));
++    }
++    else {
++        $db_driver="mysql";
++    }
++
++    my $db_name   = $context->config("database");
++    my $db_host   = $context->config("hostname");
++    my $db_port   = $context->config("port") || '';
++    my $db_user   = $context->config("user");
++    my $db_passwd = $context->config("pass");
++    my $schema = Koha::Schema->connect( "DBI:$db_driver:dbname=$db_name;host=$db_host;port=$db_port",
++      $db_user, $db_passwd);
++    return $schema;
++}
++
++
sub KOHAVERSION {
my $cgidir = C4::Context->intranetdir;
diff --cc opac/opac-account.pl index 43a1e0c,43a1e0c..376ae98 --- a/opac/opac-account.pl +++ b/opac/opac-account.pl @@@ -17,16 -17,16 +17,20 @@@
# wrriten 15/10/2002 by finlay@katipo.oc.nz # script to display borrowers account details in the opac ++# Edited by chrisc@catalyst.net.nz
use strict; use CGI; use C4::Members; ++use C4::Context; use C4::Circulation; use C4::Auth; use C4::Output; use C4::Dates qw/format_date/; ++use DBIx::Class::ResultClass::HashRefInflator; use warnings;
++
my $query = new CGI;
my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
{
@@@ -40,9 -40,9 +44,16 @@@
);
# get borrower information ....
--my $borr = GetMemberDetails( $borrowernumber );
++# my $borr = GetMemberDetails( $borrowernumber );
++my $context = C4::Context->new;
++my $schema = $context->schema;
++my $rs = $schema->resultset('Borrowers')->search({ borrowernumber => $borrowernumber });
++$rs->result_class('DBIx::Class::ResultClass::HashRefInflator');
++my $borr = $rs->first;
++use Data::Dumper;
++warn Dumper $borr;
my @bordat;
--$bordat[0] = $borr;
++push @bordat,$borr;
$template->param( BORROWER_INFO => @bordat );
So not many changes at all, i’ll work on changing some more, but it looks like adding DBIx::Class can be done in a gradual way.