Subject: | Namespace checking should allow uppercase letters |
I'm running Perl 5.8.8 (Ubuntu 8.04.3 (Hardy) kernel 2.6.24-24). The
problem below is Ubuntu's official distribution of XML-RSS (1.31) and
also 1.44 which I just downloaded.
Using the example that Creative Commons has to demonstrate how to
include a license in an RSS file
(http://static.userland.com/gems/backend/rssCreativeCommonsExample.xml),
I tried this:
my $rss = XML::RSS->new( version => '2.0' );
$rss->add_module(prefix=>'creativeCommons',
uri=>'http://backend.userland.com/creativeCommonsRssModule');
$rss->channel(
title => 'Some title',
link => 'http://www.example.com/',
...
creativeCommons => {license =>
'http://creativecommons.org/licenses/by-nc-nd/3.0/us/'}
);
The error generated by XML-RSS is:
a namespace prefix should look like [a-z_][a-z0-9.\-_]* at
/tmp/rsstest.pl line 14
It doesn't like the capital "C" in the "creativeCommons" namespace
prefix, but I can't find anything in the RSS 2.0 spec that requires only
lowercase letters in a custom namespace. Is there any reason that
something like the patch below can't be done?
--- old/lib/XML/RSS.pm 2009-08-03 20:52:49.000000000 -0400
+++ new/lib/XML/RSS.pm 2009-08-03 20:52:49.000000000 -0400
@@ -386,8 +386,8 @@
my $self = shift;
my $hash = {@_};
- $hash->{prefix} =~ /^[a-z_][a-z0-9.\-_]*$/
- or croak "a namespace prefix should look like [a-z_][a-z0-9.\\-_]*";
+ $hash->{prefix} =~ /^[a-z_][a-z0-9.\-_]*$/i
+ or croak "a namespace prefix should look like
[A-Za-z_][A-Za-z0-9.\\-_]*";
$hash->{uri}
or croak "a URI must be provided in a namespace declaration";