[SCM] librdf-ns-perl Debian packaging branch, master, updated. debian/20130208-1-22-g47de138

Jakob Voss voss at gbv.de
Fri Apr 19 13:28:40 UTC 2013


The following commit has been merged in the master branch:
commit ad98732201dc6744c78c74d46dda6810691d125a
Author: Jakob Voss <voss at gbv.de>
Date:   Wed Nov 2 16:11:30 2011 +0100

    allow one-letter prefixes

diff --git a/lib/RDF/NS.pm b/lib/RDF/NS.pm
index e34183c..d5205dd 100644
--- a/lib/RDF/NS.pm
+++ b/lib/RDF/NS.pm
@@ -31,8 +31,8 @@ sub LOAD {
         if ( $prefix =~ /^(isa|can|new)$/ ) {
             warn "Cannot support prefix $prefix!" if $warn;
             next;
-        } elsif ( $prefix =~ /^[a-z][a-z0-9]+$/ ) {
-            if ( $namespace =~ /^[a-z][a-z0-9]+:[^"<>]*$/ ) {
+        } elsif ( $prefix =~ /^[a-z][a-z0-9]*$/ ) {
+            if ( $namespace =~ /^[a-z][a-z0-9]*:[^"<>]*$/ ) {
                 $ns->{$prefix} = $namespace;
             } elsif( $warn ) {
                 warn "Skipping invalid $prefix namespace $namespace";
@@ -85,7 +85,7 @@ sub GET {
 
 sub URI {
     my $self = shift;
-    return unless shift =~ /^([a-z][a-z0-9]+)?([:_]([^:]+))?$/;
+    return unless shift =~ /^([a-z][a-z0-9]*)?([:_]([^:]+))?$/;
     my $ns = $self->{$1 // ''};
     return unless defined $ns;
     return $self->GET($ns) unless $3;
@@ -94,7 +94,7 @@ sub URI {
 
 sub AUTOLOAD {
     my $self = shift;
-    return unless $AUTOLOAD =~ /:([a-z][a-z0-9]+)(_([^:]+))?$/;
+    return unless $AUTOLOAD =~ /:([a-z][a-z0-9]*)(_([^:]+))?$/;
     my $ns = $self->{$1} or return;
     my $local = $3 // shift;
     return $self->GET($ns) unless defined $local;
diff --git a/t/namespaces.t b/t/namespaces.t
index 497ddca..05760fb 100644
--- a/t/namespaces.t
+++ b/t/namespaces.t
@@ -52,4 +52,7 @@ is( $first, $rdf, 'SELECT (scalar)' );
 $ns->{''} = "http://example.org/";
 is( $ns->URI(":foo"), "http://example.org/foo", "empty prefix allowed" );
 
+$ns = bless( { 'x' => 'http://example.org/' }, 'RDF::NS');
+is( $ns->x_alice, "http://example.org/alice", "blessed alone, one-letter prefix" );
+
 done_testing;

-- 
librdf-ns-perl Debian packaging



More information about the Pkg-perl-cvs-commits mailing list