NAME

Example-3 Another simple example

Example 3

Another simple example shows how to create a basic command line tool. The script would be called from the command line using local rdf and xsl files, with output going to STDOUT. If any step fails, then the eval catches it, and the error is printed instead.

#!/usr/bin/perl
use strict;
use XML::RSS::Tools;
my $rss  = XML::RSS::Tools->new;
eval { print $rss->rss_file(shift)->xsl_file(shift)->transform->as_string; };
print $rss->as_string('error') if ($@);