| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package CQL::Prefix; | 
| 2 |  |  |  |  |  |  |  | 
| 3 | 8 |  |  | 8 |  | 49 | use strict; | 
|  | 8 |  |  |  |  | 15 |  | 
|  | 8 |  |  |  |  | 357 |  | 
| 4 | 8 |  |  | 8 |  | 47 | use warnings; | 
|  | 8 |  |  |  |  | 15 |  | 
|  | 8 |  |  |  |  | 230 |  | 
| 5 | 8 |  |  | 8 |  | 46 | use Carp qw( croak ); | 
|  | 8 |  |  |  |  | 14 |  | 
|  | 8 |  |  |  |  | 3032 |  | 
| 6 |  |  |  |  |  |  |  | 
| 7 |  |  |  |  |  |  | =head1 NAME | 
| 8 |  |  |  |  |  |  |  | 
| 9 |  |  |  |  |  |  | CQL::Prefix - represents a CQL prefix mapping | 
| 10 |  |  |  |  |  |  |  | 
| 11 |  |  |  |  |  |  | =head1 SYNOPSIS | 
| 12 |  |  |  |  |  |  |  | 
| 13 |  |  |  |  |  |  | use CQL::Prefix; | 
| 14 |  |  |  |  |  |  |  | 
| 15 |  |  |  |  |  |  | =head1 DESCRIPTION | 
| 16 |  |  |  |  |  |  |  | 
| 17 |  |  |  |  |  |  | Represents a CQL prefix mapping from short name to long identifier. | 
| 18 |  |  |  |  |  |  |  | 
| 19 |  |  |  |  |  |  | =head1 METHODS | 
| 20 |  |  |  |  |  |  |  | 
| 21 |  |  |  |  |  |  | =head2 new() | 
| 22 |  |  |  |  |  |  |  | 
| 23 |  |  |  |  |  |  | You need to pass in the name and identifier parameters. | 
| 24 |  |  |  |  |  |  |  | 
| 25 |  |  |  |  |  |  | The name is the short name of the prefix mapping. That is, the prefix | 
| 26 |  |  |  |  |  |  | itself, such as dc, as it might be used in a qualifier like dc.title. | 
| 27 |  |  |  |  |  |  |  | 
| 28 |  |  |  |  |  |  | The identifier is the name of the prefix mapping.  That is, | 
| 29 |  |  |  |  |  |  | typically, a URI permanently allocated to a specific qualifier | 
| 30 |  |  |  |  |  |  | set, such as http://zthes.z3950.org/cql/1.0. | 
| 31 |  |  |  |  |  |  |  | 
| 32 |  |  |  |  |  |  | my $prefix = CQL::Prefix->new( | 
| 33 |  |  |  |  |  |  | name        => 'dc', | 
| 34 |  |  |  |  |  |  | identifier  => 'http://zthes.z3950.org/cql/1.0' | 
| 35 |  |  |  |  |  |  | ); | 
| 36 |  |  |  |  |  |  |  | 
| 37 |  |  |  |  |  |  | =cut | 
| 38 |  |  |  |  |  |  |  | 
| 39 |  |  |  |  |  |  | sub new { | 
| 40 | 2 |  |  | 2 | 1 | 10 | my ($class,%opts) = @_; | 
| 41 | 2 | 50 |  |  |  | 11 | croak( 'must supply name' ) if ! exists $opts{name}; | 
| 42 | 2 | 50 |  |  |  | 10 | croak( 'must supply identifier' ) if ! exists $opts{identifier}; | 
| 43 | 2 |  |  |  |  | 18 | my $self = { name => $opts{name}, identifier => $opts{identifier} }; | 
| 44 | 2 |  | 33 |  |  | 19 | return bless $self, ref($class) || $class; | 
| 45 |  |  |  |  |  |  | } | 
| 46 |  |  |  |  |  |  |  | 
| 47 |  |  |  |  |  |  | =head2 getName() | 
| 48 |  |  |  |  |  |  |  | 
| 49 |  |  |  |  |  |  | =cut | 
| 50 |  |  |  |  |  |  |  | 
| 51 |  |  |  |  |  |  | sub getName { | 
| 52 | 4 |  |  | 4 | 1 | 26 | return shift->{name}; | 
| 53 |  |  |  |  |  |  | } | 
| 54 |  |  |  |  |  |  |  | 
| 55 |  |  |  |  |  |  | =head2 getIdentifier() | 
| 56 |  |  |  |  |  |  |  | 
| 57 |  |  |  |  |  |  | =cut | 
| 58 |  |  |  |  |  |  |  | 
| 59 |  |  |  |  |  |  | sub getIdentifier { | 
| 60 | 3 |  |  | 3 | 1 | 25 | return shift->{identifier}; | 
| 61 |  |  |  |  |  |  | } | 
| 62 |  |  |  |  |  |  |  | 
| 63 |  |  |  |  |  |  | 1; |