Commit c1502177 authored by Leigh B Stoller's avatar Leigh B Stoller

Tweaks to the HRN object.

parent 9d5233e5
...@@ -312,12 +312,15 @@ sub new($$) ...@@ -312,12 +312,15 @@ sub new($$)
print STDERR "GeniHRN::new: invalid urn $urn\n"; print STDERR "GeniHRN::new: invalid urn $urn\n";
return undef; return undef;
} }
my ($domain,$type,$id) = GeniHRN::Parse($urn); my ($authority,$type,$id) = GeniHRN::Parse($urn);
my $self = {}; my $self = {};
$self->{'urn'} = $urn; $self->{'urn'} = $urn;
$self->{'domain'} = $domain;
$self->{'type'} = $type; $self->{'type'} = $type;
$self->{'id'} = $id; $self->{'id'} = $id;
$self->{'authority'} = $authority;
my ($domain,$subauth) = split(":", $authority);
$self->{'domain'} = $domain;
$self->{'subauth'} = $subauth;
bless($self, $class); bless($self, $class);
return $self; return $self;
...@@ -326,7 +329,9 @@ sub new($$) ...@@ -326,7 +329,9 @@ sub new($$)
sub field($$) { return ($_[0]->{$_[1]}); } sub field($$) { return ($_[0]->{$_[1]}); }
sub urn($) { return field($_[0], "urn"); } sub urn($) { return field($_[0], "urn"); }
sub asString($) { return $_[0]->urn(); } sub asString($) { return $_[0]->urn(); }
sub authority($) { return field($_[0], "authority"); }
sub domain($) { return field($_[0], "domain"); } sub domain($) { return field($_[0], "domain"); }
sub subauth($) { return field($_[0], "subauth"); }
sub type($) { return field($_[0], "type"); } sub type($) { return field($_[0], "type"); }
sub id($) { return field($_[0], "id"); } sub id($) { return field($_[0], "id"); }
sub IsAuthority() { return $_[0]->type() =~ /^authority$/i ? 1 : 0; } sub IsAuthority() { return $_[0]->type() =~ /^authority$/i ? 1 : 0; }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment