/usr/share/perl5/RDF/Redland/URI.pm is in librdf-perl 1.0.16.1-1.1ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 | # -*- Mode: Perl -*-
#
# URI.pm - Redland Perl RDF URI module
#
# Copyright (C) 2000-2005 David Beckett - http://www.dajobe.org/
# Copyright (C) 2000-2005 University of Bristol - http://www.bristol.ac.uk/
#
# This package is Free Software and part of Redland http://librdf.org/
#
# It is licensed under the following three licenses as alternatives:
# 1. GNU Lesser General Public License (LGPL) V2.1 or any newer version
# 2. GNU General Public License (GPL) V2 or any newer version
# 3. Apache License, V2.0 or any newer version
#
# You may not use this file except in compliance with at least one of
# the above three licenses.
#
# See LICENSE.html or LICENSE.txt at the top of this package for the
# full license terms.
#
#
#
package RDF::Redland::URI;
use strict;
use Encode;
=pod
=head1 NAME
RDF::Redland::URI - Redland RDF URI Class
=head1 SYNOPSIS
use RDF::Redland;
my $uri=new RDF::Redland::URI("http://example.com/");
my $uri2=RDF::Redland::URI->new_from_uri($uri);
print $uri2->as_string,"\n";
=head1 DESCRIPTION
Represents a URI as a mostly-opaque object for identifying things
in the RDF world. The URIs are also used for identifying features
for the RDF::Redland::Parser and RDF::Redland::Serializer classes.
=cut
######################################################################
=pod
=head1 CONSTRUCTORS
=over
=item new STRING
Create a new RDF::Redland::URI object from a URI string.
=cut
sub new ($$) {
my($proto,$arg)=@_;
my $class = ref($proto) || $proto;
my $self = {};
if(my $arg_class=ref($arg)) {
if(UNIVERSAL::isa($arg, 'RDF::Redland::URI')) {
return $arg->clone;
} elsif (UNIVERSAL::isa($arg, 'URI::URL')) {
$arg=$arg->as_string;
} else {
die "RDF::Redland::URI::new - Cannot make a URI from an object of class $arg_class\n";
}
}
$self->{URI}=&RDF::Redland::CORE::librdf_new_uri($RDF::Redland::World->{WORLD},$arg);
return undef if !$self->{URI};
bless ($self, $class);
return $self;
}
=item clone URI
Copy a RDF::Redland::URI
=cut
sub clone ($) {
my($uri)=@_;
my $class = ref($uri);
my $self = {};
if(!$class || $class ne 'RDF::Redland::URI') {
die "RDF::Redland::URI::clone - Cannot copy a URI object not of class RDF::Redland::URI\n";
}
$self->{URI}=&RDF::Redland::CORE::librdf_new_uri_from_uri($uri->{URI});
return undef if !$self->{URI};
bless ($self, $class);
return $self;
}
sub new_from_uri ($$) {
my($proto,$uri)=@_;
return $uri->clone;
}
sub _new_from_object ($$) {
my($proto,$object)=@_;
my $class = ref($proto) || $proto;
my $self = {};
warn "RDF::Redland::URI->_new_from_object from object $object\n" if $RDF::Redland::Debug;
$self->{URI}=$object;
$self->{DONT_FREE_ME}=1;
bless ($self, $class);
return $self;
}
=pod
=back
=cut
sub DESTROY ($) {
my $self=shift;
warn "RDF::Redland::URI DESTROY\n" if $RDF::Redland::Debug;
if($self->{URI}) {
if(!$self->{DONT_FREE_ME}) {
&RDF::Redland::CORE::librdf_free_uri($self->{URI});
}
}
}
=head1 METHODS
=over
=item as_string
Return the statement formatted as a string (UTF-8 encoded).
=cut
sub as_string ($) {
return decode_utf8(&RDF::Redland::CORE::librdf_uri_to_string(shift->{URI}));
}
=item equals URI
Return non zero if this uri is equal to URI
=cut
sub equals ($$) {
my($self,$uri)=@_;
&RDF::Redland::CORE::librdf_uri_equals($self->{URI}, $uri->{URI});
}
=pod
=back
=head1 OLD METHODS
=over
=item new_from_uri URI
Create a new RDF::Redland::URI object from RDF::Redland::URI I<URI>
(copy constructor). Instead use:
$u=$uri->clone
=back
=head1 SEE ALSO
L<RDF::Redland::Parser>
=head1 AUTHOR
Dave Beckett - http://www.dajobe.org/
=cut
1;
|