2006-07-28.05:11:00.DBIC_and_Pg_functions

So I'm going to kill two birds and both test if this POC handles multiple posts properly and document a nifty bit of DBIx::Class hackery. If perchance one is given a Postgresql function where the following works in psql:
SELECT name FROM getcourses('STUDENT');
      name
----------------
 nmap
 nessus
 reversing
 exploitwriting
 snort
 honeypot
 scapy
 cisco
 wifi
 bluetooth
 pacsec
(11 rows)
The correct way of making this work in DBIx::Class is the following bit of code:
my $rs = $schema->resultset('Getcourses')->search(undef,
{
  from => 'getcourses(\'STUDENT\') me',
})->first;
print "Name ",$rs->name, "\n";
The nice thing is that it just works, once you figure this out. You can add WHERE clauses, and in pretty much all respects treat it like a standard resultset. Obviously don't write to it, I haven't figured out how to get that abstraction to work as well (yet).