File: convert.pl

package info (click to toggle)
libxml-rss-perl 1.48-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 756 kB
  • ctags: 231
  • sloc: perl: 6,888; xml: 378; makefile: 2
file content (30 lines) | stat: -rw-r--r-- 568 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/usr/bin/perl

use strict;
use warnings;

use XML::RSS;

# print an error unless there are 2 command-line args
&syntax unless @ARGV == 2;

# get rss file and version to convert to from
# the command line
my ($file,$version) = @ARGV;

# create new instance
my $rss = XML::RSS->new;

# set output version
$rss->{output} = $version unless $version eq 'default';

# parse the rss file
$rss->parsefile(shift);

# output the new RSS to STDOUT
print $rss->as_string;

sub syntax {
    die "Syntax: convert.pl <file.rss> <version>\n    ex: convert.pl fm.rdf 1.0\n\n";
}