| line | stmt | bran | cond | sub | pod | time | code | 
| 1 | 50 |  |  | 50 |  | 606 | use v5.14; | 
|  | 50 |  |  |  |  | 188 |  | 
| 2 | 50 |  |  | 50 |  | 261 | use warnings; | 
|  | 50 |  |  |  |  | 118 |  | 
|  | 50 |  |  |  |  | 2002 |  | 
| 3 |  |  |  |  |  |  |  | 
| 4 |  |  |  |  |  |  | =head1 NAME | 
| 5 |  |  |  |  |  |  |  | 
| 6 |  |  |  |  |  |  | Attean::IRI - RDF Internationalized Resource Identifiers (IRIs) | 
| 7 |  |  |  |  |  |  |  | 
| 8 |  |  |  |  |  |  | =head1 VERSION | 
| 9 |  |  |  |  |  |  |  | 
| 10 |  |  |  |  |  |  | This document describes Attean::IRI version 0.032 | 
| 11 |  |  |  |  |  |  |  | 
| 12 |  |  |  |  |  |  | =head1 SYNOPSIS | 
| 13 |  |  |  |  |  |  |  | 
| 14 |  |  |  |  |  |  | use v5.14; | 
| 15 |  |  |  |  |  |  | use Attean; | 
| 16 |  |  |  |  |  |  | my $term = Attean::IRI->new('http://example.org/'); | 
| 17 |  |  |  |  |  |  | $term->ntriples_string; # <http://example.org/> | 
| 18 |  |  |  |  |  |  |  | 
| 19 |  |  |  |  |  |  | =head1 DESCRIPTION | 
| 20 |  |  |  |  |  |  |  | 
| 21 |  |  |  |  |  |  | The Attean::IRI class represents RDF IRIs. | 
| 22 |  |  |  |  |  |  | It conforms to the L<Attean::API::IRI|Attean::API::Term> role | 
| 23 |  |  |  |  |  |  | and extends the L<IRI> class. | 
| 24 |  |  |  |  |  |  |  | 
| 25 |  |  |  |  |  |  | =head1 METHODS | 
| 26 |  |  |  |  |  |  |  | 
| 27 |  |  |  |  |  |  | =over 4 | 
| 28 |  |  |  |  |  |  |  | 
| 29 |  |  |  |  |  |  | =cut | 
| 30 |  |  |  |  |  |  |  | 
| 31 |  |  |  |  |  |  | use Moo; | 
| 32 | 50 |  |  | 50 |  | 265 | use Types::Standard qw(Str); | 
|  | 50 |  |  |  |  | 106 |  | 
|  | 50 |  |  |  |  | 249 |  | 
| 33 | 50 |  |  | 50 |  | 15730 | use IRI 0.005; | 
|  | 50 |  |  |  |  | 139 |  | 
|  | 50 |  |  |  |  | 386 |  | 
| 34 | 50 |  |  | 50 |  | 24087 | use namespace::clean; | 
|  | 50 |  |  |  |  | 929 |  | 
|  | 50 |  |  |  |  | 1156 |  | 
| 35 | 50 |  |  | 50 |  | 300 |  | 
|  | 50 |  |  |  |  | 140 |  | 
|  | 50 |  |  |  |  | 387 |  | 
| 36 |  |  |  |  |  |  | extends 'IRI'; | 
| 37 |  |  |  |  |  |  |  | 
| 38 |  |  |  |  |  |  | has 'ntriples_string'	=> (is => 'ro', isa => Str, lazy => 1, builder => '_ntriples_string'); | 
| 39 |  |  |  |  |  |  |  | 
| 40 |  |  |  |  |  |  | =item C<< equals ( $iri ) >> | 
| 41 |  |  |  |  |  |  |  | 
| 42 |  |  |  |  |  |  | Returns true if C<< $iri >> is equal to the invocant, false otherwise. | 
| 43 |  |  |  |  |  |  |  | 
| 44 |  |  |  |  |  |  | =cut | 
| 45 |  |  |  |  |  |  |  | 
| 46 |  |  |  |  |  |  | # This overrides the Attean::API::TermOrVariable::equals implementation | 
| 47 |  |  |  |  |  |  | # to allow lazy IRIs to remain unparsed for the case where neither has | 
| 48 |  |  |  |  |  |  | # a base IRI. | 
| 49 |  |  |  |  |  |  | my ($a, $b)	= @_; | 
| 50 |  |  |  |  |  |  | if ($b->isa('Attean::IRI')) { | 
| 51 | 785 |  |  | 785 | 1 | 4874 | unless ($a->has_base or $b->has_base) { | 
| 52 | 785 | 100 |  |  |  | 2264 | return ($a->value eq $b->value); | 
| 53 | 777 | 50 | 33 |  |  | 2769 | } | 
| 54 | 777 |  |  |  |  | 3081 | } | 
| 55 |  |  |  |  |  |  | return ($a->as_string eq $b->as_string); | 
| 56 |  |  |  |  |  |  | } | 
| 57 | 8 |  |  |  |  | 24 |  | 
| 58 |  |  |  |  |  |  | with 'Attean::API::IRI'; | 
| 59 |  |  |  |  |  |  | with 'Attean::API::BlankOrIRI'; | 
| 60 |  |  |  |  |  |  |  | 
| 61 |  |  |  |  |  |  | around BUILDARGS => sub { | 
| 62 |  |  |  |  |  |  | my $orig 	= shift; | 
| 63 |  |  |  |  |  |  | my $class	= shift; | 
| 64 |  |  |  |  |  |  | my $args; | 
| 65 |  |  |  |  |  |  | if (scalar(@_) == 1) { | 
| 66 |  |  |  |  |  |  | $args	= $class->$orig(value => shift); | 
| 67 |  |  |  |  |  |  | } else { | 
| 68 |  |  |  |  |  |  | $args	= $class->$orig(@_); | 
| 69 |  |  |  |  |  |  | } | 
| 70 |  |  |  |  |  |  |  | 
| 71 |  |  |  |  |  |  | if (exists $args->{base}) { | 
| 72 |  |  |  |  |  |  | # fully qualify IRIs | 
| 73 |  |  |  |  |  |  | my $iri	= IRI->new( %$args ); | 
| 74 |  |  |  |  |  |  | $args	= { value => $iri->as_string }; | 
| 75 |  |  |  |  |  |  | } | 
| 76 |  |  |  |  |  |  | return $args; | 
| 77 |  |  |  |  |  |  | }; | 
| 78 |  |  |  |  |  |  |  | 
| 79 |  |  |  |  |  |  | =item C<< as_string >> | 
| 80 |  |  |  |  |  |  |  | 
| 81 |  |  |  |  |  |  | Returns the IRI value. | 
| 82 |  |  |  |  |  |  |  | 
| 83 |  |  |  |  |  |  | =cut | 
| 84 |  |  |  |  |  |  |  | 
| 85 |  |  |  |  |  |  | my $self	= shift; | 
| 86 |  |  |  |  |  |  | return $self->abs; | 
| 87 |  |  |  |  |  |  | } | 
| 88 | 1714 |  |  | 1714 | 1 | 40734 | } | 
| 89 | 1714 |  |  |  |  | 28806 |  | 
| 90 |  |  |  |  |  |  | 1; | 
| 91 |  |  |  |  |  |  |  | 
| 92 |  |  |  |  |  |  |  | 
| 93 |  |  |  |  |  |  | =back | 
| 94 |  |  |  |  |  |  |  | 
| 95 |  |  |  |  |  |  | =head1 BUGS | 
| 96 |  |  |  |  |  |  |  | 
| 97 |  |  |  |  |  |  | Please report any bugs or feature requests to through the GitHub web interface | 
| 98 |  |  |  |  |  |  | at L<https://github.com/kasei/attean/issues>. | 
| 99 |  |  |  |  |  |  |  | 
| 100 |  |  |  |  |  |  | =head1 SEE ALSO | 
| 101 |  |  |  |  |  |  |  | 
| 102 |  |  |  |  |  |  | L<IRI> | 
| 103 |  |  |  |  |  |  |  | 
| 104 |  |  |  |  |  |  | L<http://www.ietf.org/rfc/rfc3987.txt> | 
| 105 |  |  |  |  |  |  |  | 
| 106 |  |  |  |  |  |  |  | 
| 107 |  |  |  |  |  |  |  | 
| 108 |  |  |  |  |  |  | =head1 AUTHOR | 
| 109 |  |  |  |  |  |  |  | 
| 110 |  |  |  |  |  |  | Gregory Todd Williams  C<< <gwilliams@cpan.org> >> | 
| 111 |  |  |  |  |  |  |  | 
| 112 |  |  |  |  |  |  | =head1 COPYRIGHT | 
| 113 |  |  |  |  |  |  |  | 
| 114 |  |  |  |  |  |  | Copyright (c) 2014--2022 Gregory Todd Williams. | 
| 115 |  |  |  |  |  |  | This program is free software; you can redistribute it and/or modify it under | 
| 116 |  |  |  |  |  |  | the same terms as Perl itself. | 
| 117 |  |  |  |  |  |  |  | 
| 118 |  |  |  |  |  |  | =cut |