NAME
UnixODBC::RSS.pm - Create RSS output from a UnixODBC query.
SYNOPSIS
use UnixODBC;
use UnixODBC::RSS;
my $rdf = new UnixODBC::RSS;
$rdf -> Channel ({'title' => 'feed_title',
'description' => 'feed_description',
'link' => 'url'});
$rdf -> ItemColumns ({'column_name_of_title_content' => 'title',
'column_name_of_description_content' => 'description',
'column_name_of_name_content' => 'name',
'column_name_of_link_content' => 'link'});
$rdf -> Output (\@resultset, *STDOUT);
DESCRIPTION
UnixODBC::RSS.pm formats query results as a RSS version 1.0 RDF file. The result set must be an array of array references, with the first row containing column names.
The Channel() method's argument is an anonymous hash or hash reference that provides RSS channel identification for <channel> and member tags: <title>, <description>, and <url>.
The method, ItemColumns(), takes as its argument an anonymous hash or hash reference. Each key-value pair describes the result set column that provides content for an <item> member: <title>, <name>, <description>, or <link>.
Output() takes as its arguments the result set as an array reference and an output filehandle.
Creating a RSS RDF file follows approximately these steps:
# Allocate Environment, Connection, and statement handles, and connect
# to DSN....
$r = SQLPrepare ($sth, $Query, length ($Query));
$r = SQLExecute ($sth);
my $ncols;
$r = SQLNumResultCols ($sth,$ncols);
my ($col, $buf, $rfetch, $rget, $colarrayref, @rowarray, $rlen, $n);
my $colheadref = new_array_ref ();
# Get column headings
for ($col = 1; $col <= $ncols; $col++) {
$r = SQLColAttribute ($sth, $col, $SQL_COLUMN_NAME, $buf,
$SQL_MAX_MESSAGE_LENGTH, $rlen, $n);
$$colheadref[$col - 1] = $buf;
}
push @rowarray, ($colheadref);
# Get column data
while (1) {
$rfetch = SQLFetch ($sth);
last if $rfetch == $SQL_NO_DATA;
$colarrayref = new_array_ref ();
for ( $col = 1; $col <= $ncols; $col++) {
$rget = SQLGetData ($sth, $col, $SQL_CHAR, $buf,
$SQL_MAX_MESSAGE_LENGTH, $rlen);
$$colarrayref[$col - 1] = $buf;
}
push @rowarray, ($colarrayref);
}
$rss -> Output (\@rowarray, *STDOUT);
sub new_array_ref { my @a; return \@a; }
VERSION INFORMATION AND CREDITS
Version 0.01
Copyright © 2004 Robert Kiesling, rkies@cpan.org.
Licensed under the same terms as Perl. Refer to the file, "Artistic," for details.
BUGS
This version does not perform validation and does not check for required keys. The <image> tag does not yet have an output method.
SEE ALSO
UnixODBC(3), XML::RSS(3), rssoutput(1)
1 POD Error
The following errors were encountered while parsing the POD:
- Around line 187:
Non-ASCII character seen before =encoding in '©'. Assuming CP1252