File Coverage

blib/lib/URI/OpenURL.pm
Criterion Covered Total %
statement 129 210 61.4
branch 27 74 36.4
condition 8 35 22.8
subroutine 33 46 71.7
pod 14 14 100.0
total 211 379 55.6


line stmt bran cond sub pod time code
1             package URI::OpenURL;
2              
3             =pod
4              
5             =head1 NAME
6              
7             URI::OpenURL - Parse and construct OpenURL's (NISO Z39.88-2004)
8              
9             =head1 DESCRIPTION
10              
11             This module provides an implementation of OpenURLs encoded as URIs (Key/Encoded-Value (KEV) Format), this forms only a part of the OpenURL spec. It does not check that OpenURLs constructed are sane according to the OpenURL specification (to a large extent sanity will depend on the community of use).
12              
13             From the implementation guidelines:
14              
15             The description of a referenced resource, and the descriptions of the associated resources that comprise the context of the reference, bundled together are called a ContextObject. It is a ContextObject that is transported when a user makes a request by clicking a link. A KEV OpenURL may contain only one ContextObject.
16              
17             The ContextObject may contain up to six Entities. One of these, the Referent, conveys information about the referenced item. It must always be included in a ContextObject. The other five entities - ReferringEntity, Requester, Resolver, ServiceType and Referrer - hold information about the context of the reference and are optional.
18              
19             =head1 OpenURL
20              
21             http://library.caltech.edu/openurl/
22              
23             From the implementation guidelines:
24              
25             The OpenURL Framework for Context-Sensitive Services Standard provides a means of describing a referenced resource along with a description of the context of the reference. Additionally it defines methods of transporting these descriptions between networked systems. It is anticipated that it will be used to request services pertaining to the referenced resource and appropriate for the requester.
26              
27             The OpenURL Framework is very general and has the potential to be used in many application domains and by many communities. Concrete instantiations of the various core components within the framework are defined within the OpenURL Registry. The OpenURL Framework is currently a .draft standard for ballot.. During the ballot and public review period, the content of the Registry will be static and has been pre-defined by the NISO AX Committee. There is also an experimental registry where components under development are held. In the future it will be possible to register further items.
28              
29             There are currently two formats for ContextObjects defined in the OpenURL Framework, Key/Encoded-Value and XML. This document provides implementation guidelines for the Key/Encoded-Value Format, concentrating mainly, but not exclusively, on components from the San Antonio Level 1 Community Profile (SAP1).
30              
31             =head1 SYNOPSIS
32              
33             use URI::OpenURL;
34              
35             # Construct an OpenURL
36             # This is the first example from the implementation specs,
37             # with additional resolver and serviceType entities.
38             print URI::OpenURL->new('http://other.service/cgi/openURL'
39             )->referrer(
40             id => 'info:sid/my.service',
41             )->requester(
42             id => 'mailto:john@invalid.domain',
43             )->resolver(
44             id => 'info:sid/other.service',
45             )->serviceType()->scholarlyService(
46             fulltext => 'yes',
47             )->referringEntity(id => 'info:doi/10.1045/march2001-vandesompel')->journal(
48             genre => 'article',
49             aulast => 'Van de Sompel',
50             aufirst => 'Herbert',
51             issn => '1082-9873',
52             volume => '7',
53             issue => '3',
54             date => '2001',
55             atitle => 'Open Linking in the Scholarly Information Environment using the OpenURL Framework',
56             )->referent(id => 'info:doi/10.1045/july99-caplan')->journal(
57             genre => 'article',
58             aulast => 'Caplan',
59             aufirst => 'Priscilla',
60             issn => '1082-9873',
61             volume => '5',
62             issue => '7/8',
63             date => '1999',
64             atitle => 'Reference Linking for Journal Articles',
65             )->as_string();
66              
67             # Parsing (wrappers for $uri->query_form())
68             my $uri = URI::OpenURL->new('http://a.OpenURL/?url_ver=Z39.88-2004&...');
69             my @referent = $uri->referent->metadata();
70             print join(',',@referent), "\n";
71             # This could lose data if there is more than one id
72             my %ds = $uri->referent->descriptors();
73             if( !exists($ds{val_fmt}) ) {
74             warn "No by-value metadata for referent in OpenURL";
75             } elsif($ds{val_fmt} eq 'info:ofi/fmt:kev:mtx:journal') {
76             my %md = $uri->referent->metadata();
77             print ($md{genre} || 'Unknown journal article genre'), "\n";
78             }
79            
80             if( $uri->referent->val_fmt() eq 'info:ofi/fmt:kev:mtx:journal' ) {
81             print "The referent is a journal article.\n";
82             }
83              
84             =head1 METHODS
85              
86             =over 4
87              
88             =cut
89              
90 5     5   47730 use vars qw( $VERSION );
  5         12  
  5         411  
91              
92             $VERSION = '0.4.6';
93              
94 5     5   30 use strict;
  5         8  
  5         150  
95 5     5   4910 use URI::Escape;
  5         9363  
  5         351  
96 5     5   33 use Carp;
  5         9  
  5         335  
97 5     5   5057 use POSIX qw/ strftime /;
  5         42594  
  5         38  
98              
99             require URI;
100             require URI::_server;
101 5     5   6810 use vars qw( @ISA );
  5         19  
  5         10951  
102             @ISA = qw( URI::_server );
103              
104             =pod
105              
106             =item $uri = URI::OpenURL->new([$url])
107              
108             Create a new URI::OpenURL object and optionally initialize with $url. If $url does not contain a query component (...?key=value) the object will be initialized to a valid contextobject, but without any entities.
109              
110             If you don't want the context object version and encoding specify url_ver e.g.
111              
112             use URI::OpenURL;
113             my $uri = URI::OpenURL->new(
114             'http://myresolver.com/openURL?url_ver=Z39.88-2004'
115             );
116              
117             =cut
118              
119             sub new {
120 5     5 1 84 _init(@_);
121             }
122              
123             sub _init {
124 5     5   89 my $self = shift->SUPER::_init(@_);
125 5 100       1075 $self->query_form(
126             url_ver => 'Z39.88-2004',
127             ) unless $self->query();
128 5         725 $self;
129             }
130              
131             =pod
132              
133             =item $uri = URI::OpenURL->new_from_hybrid($uri)
134              
135             Create a new URI::OpenURL object from a hybrid OpenURL (version 0.1 and/or 1.0 KEVS). Use this to parse a version 0.1 (SFX) style OpenURL.
136              
137             =cut
138              
139             sub new_from_hybrid
140             {
141 0     0 1 0 my ($class,$uri) = @_;
142 0   0     0 $class = ref($class) || $class;
143 0         0 my $self = $class->new($uri);
144             # If we already have a 1.0 OpenURL just return a canonical 1.0
145 0         0 my @KEVS = $self->query_form;
146 0         0 my %kevs = @KEVS;
147 0   0     0 my $genre = $kevs{'genre'} || 'article';
148 0 0 0     0 if( $kevs{url_ver} && $kevs{url_ver} eq 'Z39.88-2004' ) {
149 0         0 return $self->canonical();
150             }
151             # Initialize the OpenURL (url_ver etc.)
152 0         0 $self->query('');
153 0         0 $self = $class->new($self);
154             # Tidy up the 0.1 keys
155 0         0 for(my $i = 0; $i < @KEVS;) {
156 0 0       0 if( $KEVS[$i] eq 'sid' ) {
    0          
    0          
157 0         0 $self->referrer->id('info:sid/'.$KEVS[$i+1]);
158 0         0 splice(@KEVS,$i,2);
159             } elsif( $KEVS[$i] eq 'id' ) {
160 0 0       0 if( $KEVS[$i+1] =~ s/(^doi|pmid|bibcode):// ) {
161 0         0 $self->referent->id("info:$1/".$KEVS[$i+1]);
162             } else {
163 0         0 $self->referent->id($KEVS[$i+1]);
164             }
165 0         0 splice(@KEVS,$i,2);
166             } elsif( $KEVS[$i] eq 'pid' ) {
167 0         0 $self->referent->dat($KEVS[$i+1]);
168 0         0 splice(@KEVS,$i,2);
169             } else {
170 0 0       0 $KEVS[$i] = 'jtitle' if $KEVS[$i] eq 'title';
171 0         0 $i += 2;
172             }
173             }
174             # Map genre onto a ctx format and add the metadata
175 0 0       0 if( $genre =~ '^article|preprint|proceeding$' ) {
    0          
176 0         0 $self->referent->journal(@KEVS);
177             } elsif( $genre eq 'bookitem' ) {
178 0         0 $self->referent->book(@KEVS);
179             } else {
180 0         0 die "Unable to handle version 0.1 genre: $genre";
181             }
182 0         0 $self;
183             }
184              
185             =pod
186              
187             =item @qry = $uri->query_form([key, value, [key, value]])
188              
189             Equivalent to URI::query_form, but with support for UTF-8 encoding.
190              
191             =cut
192              
193             sub query_form
194             {
195 46     46 1 730 my $self = shift;
196 46         122 my @new = @_;
197 46 50       108 if( 1 == @new ) {
198 0         0 my $n = $new[0];
199 0 0       0 if( ref($n) eq "ARRAY" ) {
    0          
200 0         0 @new = @$n;
201             } elsif( ref($n) eq "HASH" ) {
202 0         0 @new = %$n;
203             }
204             }
205 46         75 for (@new) {
206 362         667 utf8::encode($_);
207             }
208 46         187 map { utf8::decode($_); $_ } $self->SUPER::query_form(@new);
  694         14368  
  694         1031  
209             }
210              
211             =pod
212              
213             =item $uri->init_ctxobj_version()
214              
215             Add ContextObject versioning.
216              
217             =cut
218              
219             sub init_ctxobj_version
220             {
221 1     1 1 2 my $self = shift;
222 1         13 my %query = $self->query_form;
223             return if
224 1 50 33     8 defined($query{'ctx_ver'}) &&
225             $query{'ctx_ver'} eq 'Z39.88-2004';
226 1         4 $self->query_form(
227             $self->query_form,
228             ctx_ver => 'Z39.88-2004',
229             ctx_enc => 'info:ofi/enc:UTF-8',
230             url_ctx_fmt => 'info:ofi/fmt:kev:mtx:ctx',
231             );
232             }
233              
234             =pod
235              
236             =item $ts = $uri->init_timestamps([ctx_timestamp, [url_timestamp]])
237              
238             Add ContextObject and URL timestamps, returns the old timestamp(s) or undef on none.
239              
240             =cut
241              
242             sub init_timestamps {
243 3     3 1 702 my $self = shift;
244 3   66     88 my $ctx_timestamp = shift ||
245             strftime("%Y-%m-%dT%H:%M:%STZD",gmtime(time));
246 3   33     14 my $url_timestamp = shift || $ctx_timestamp;
247 3         7 my @query = $self->query_form;
248 3         10 my @old;
249 3         9 for(my $i = 0; $i < @query;) {
250 13 100       30 if( $query[$i] eq 'ctx_tim' ) {
    100          
251 2         9 ($_,$old[0]) = splice(@query,$i,2);
252             } elsif( $query[$i] eq 'url_tim' ) {
253 2         7 ($_,$old[1]) = splice(@query,$i,2);
254             } else {
255 9         18 $i+=2;
256             }
257             }
258 3         9 $self->query_form(
259             @query,
260             'ctx_tim', $ctx_timestamp,
261             'url_tim', $url_timestamp,
262             );
263 3 50 66     25 wantarray ? @old : ($old[0]||$old[1]);
264             }
265              
266             =pod
267              
268             =item $uri = $uri->as_hybrid()
269              
270             Return the OpenURL as a hybrid 0.1/1.0 OpenURL (contains KEVs for both versions). Returns a new URI::OpenURL object.
271              
272             =cut
273              
274             sub as_hybrid
275             {
276 0     0 1 0 my $self = shift;
277 0         0 my @KEVS = $self->query_form;
278             # Add the referent
279 0         0 my @md = $self->referent->metadata();
280             # 'title' has been changed to 'jtitle' in 1.0
281 0         0 for(my $i = 0; $i < @md; $i+=2) {
282 0 0       0 $md[$i] = 'title' if($md[$i] eq 'jtitle');
283             }
284 0         0 push @KEVS, @md;
285             # Add the referrer's id
286 0         0 my $rfr_id = $self->referrer->id;
287 0 0 0     0 if( defined($rfr_id) && $rfr_id =~ s/^info:sid\/// ) {
288 0         0 push @KEVS, sid => $rfr_id;
289             }
290             # Add the referent's id (if its compatible with 0.1)
291 0         0 my $rft_id = $self->referent->id;
292 0 0 0     0 if( defined($rft_id) &&
      0        
293             ($rft_id =~ s/^info:(doi|pmid|bibcode)\//$1:/ ||
294             $rft_id =~ /^oai:/)
295             ) {
296 0         0 push @KEVS, id => $rft_id;
297             }
298             # Return a new URI (otherwise we pollute ourselves)
299 0         0 my $hybrid = new URI::OpenURL($self);
300 0         0 $hybrid->query_form(@KEVS);
301 0         0 $hybrid;
302             }
303              
304             =item $uri = $uri->canonical()
305              
306             Return a canonical OpenURL by removing anything that isn't part of the version 1.0 specification.
307              
308             =cut
309              
310             sub canonical
311             {
312 0     0 1 0 my $uri = shift->SUPER::canonical();
313 0         0 $uri = bless $uri, "URI::OpenURL";
314 0         0 my @KEVS = $uri->query_form();
315 0         0 for(my $i = 0; $i < @KEVS; ) {
316 0 0       0 if( $KEVS[$i] !~ /^ctx_ver|ctx_enc|ctx_id|ctx_tim|url_ver|url_tim|url_ctx_fmt|(?:(?:rft|rfe|svc|req|res|rfr)[_\.].+)$/ ) {
317 0         0 splice(@KEVS,$i,2);
318             } else {
319 0         0 $i += 2;
320             }
321             }
322 0         0 $uri->query_form(@KEVS);
323 0         0 $uri;
324             }
325              
326             =pod
327              
328             =item $str = $uri->dump()
329              
330             Return the OpenURL as a human-readable string (useful for debugging).
331              
332             =cut
333              
334             sub dump
335             {
336 0     0 1 0 my $self = shift;
337 0         0 my $str = URI->new($self);
338 0         0 $str->query('');
339 0         0 $str .= "\n";
340 0         0 my @kevs = $self->query_form;
341 0         0 for(my $i = 0; $i < @kevs; $i+=2) {
342 0         0 $str .= $kevs[$i] . "=" . $kevs[$i+1] . "\n";
343             }
344 0         0 $str;
345             }
346              
347             =pod
348              
349             =item $uri = $uri->referent()
350              
351             Every ContextObject must have a Referent, the referenced resource for which the ContextObject is created. Within the scholarly information community the Referent will probably be a document-like object, for instance: a book or part of a book; a journal publication or part of a journal; a report; etc.
352              
353             =cut
354              
355             sub referent {
356 5     5 1 821 my $self = bless shift, 'URI::OpenURL::referent';
357 5 50       23 return $self->descriptors() if wantarray;
358 5         42 $self->_addattr(@_);
359             }
360              
361             =pod
362              
363             =item $uri->referringEntity()
364              
365             The ReferringEntity is the Entity that references the Referent. It is optional in the ContextObject. Within the scholarly information community the ReferringEntity could be a journal article that cites the Referent. Or it could be a record within an abstracting and indexing database.
366              
367             =cut
368              
369             sub referringEntity {
370 1     1 1 4 my $self = bless shift, 'URI::OpenURL::referringEntity';
371 1 50       4 return $self->descriptors() if wantarray;
372 1         6 $self->_addattr(@_);
373             }
374              
375             =pod
376              
377             =item $uri = $uri->requester()
378              
379             The Requester is the Entity that requests services pertaining to the Referent. It is optional in the ContextObject. Within the scholarly information community the Requester is generally a human end-user who clicks a link within a digital library application.
380              
381             =cut
382              
383             sub requester {
384 1     1 1 4 my $self = bless shift, 'URI::OpenURL::requester';
385 1 50       4 return $self->descriptors() if wantarray;
386 1         7 $self->_addattr(@_);
387             }
388              
389             =item $uri = $uri->serviceType()
390              
391             The ServiceType is the Entity that defines the type of service requested. It is optional in the ContextObject. Within the scholarly information community the ServiceType could be a request for; the full text of an article; the abstract of an article; an inter-library loan request, etc.
392              
393             =cut
394              
395             sub serviceType {
396 1     1 1 4 my $self = bless shift, 'URI::OpenURL::serviceType';
397 1 50       4 return $self->descriptors() if wantarray;
398 1         6 $self->_addattr(@_);
399             }
400              
401             =pod
402              
403             =item $uri = $uri->resolver()
404              
405             The Resolver is the Entity at which a request for services is targeted. It is optional in the ContextObject. This need not be the same Resolver as that specified as the base URL for an OpenURL Transport and does not replace that base URL.
406              
407             =cut
408              
409             sub resolver {
410 1     1 1 3 my $self = bless shift, 'URI::OpenURL::resolver';
411 1 50       5 return $self->descriptors() if wantarray;
412 1         7 $self->_addattr(@_);
413             }
414              
415             =pod
416              
417             =item $uri = $uri->referrer()
418              
419             The Referrer is the Entity that generated the ContextObject. It is optional in the ContextObject, but its inclusion is strongly encouraged. Within the scholarly information community the Referrer will be an information provider such as an electronic journal application or an 'abstracting and indexing' service.
420              
421             =cut
422              
423             sub referrer {
424 1     1 1 5 my $self = bless shift, 'URI::OpenURL::referrer';
425 1 50       7 return $self->descriptors() if wantarray;
426 1         12 $self->_addattr(@_);
427             }
428              
429             =pod
430              
431             =item $uri = $uri->referent->dublinCore(key => value)
432              
433             =item $uri = $uri->referent->book(key => value)
434              
435             =item $uri = $uri->referent->dissertation(key => value)
436              
437             =item $uri = $uri->referent->journal(key => value)
438              
439             =item $uri = $uri->referent->patent(key => value)
440              
441             =item $uri = $uri->serviceType->scholarlyService(key => value)
442              
443             Add metadata to the current entity (referent is given only as an example). Dublin Core is an experimental format.
444              
445             =item @descs = $uri->referent->descriptors([$key=>$value[, $key=>$value]])
446              
447             Return the descriptors as a list of key-value pairs for the current entity (referent is given as an example).
448              
449             Optionally add descriptors (functionally equivalent to $uri->referent($key=>$value)).
450              
451             =item @metadata = $uri->referent->metadata([$schema_url, $key=>$value[, $key=>$value]])
452              
453             Returns by-value metadata as a list of key-value pairs for the current entity (referent is given as an example).
454              
455             Optionally, if you wish to add metadata that does not use one of the standard schemas (journal, book etc.) then you can add them using metadata.
456              
457             =item @vals = $uri->referent->descriptor('id')
458              
459             Return a list of values given for an entity descriptor (id, ref, dat, val_fmt, ref_fmt).
460              
461             =item $dat = $uri->referent->dat()
462              
463             =item @ids = $uri->referent->id()
464              
465             =item $ref = $uri->referent->ref()
466              
467             =item $val_fmt = $uri->referent->val_fmt()
468              
469             =item $ref_fmt = $uri->referent->ref_fmt()
470              
471             Return the respective descriptor using a method interface. An entity may contain 0 or more ids, and optionally a by-reference URI, private data, by-value format and by-reference format.
472              
473             =head1 CHANGES
474              
475             0.4.6
476             - Removed ContextObject versioning from default
477             constructor
478             0.4.5
479             - Support for URL utf-8 encoding
480             0.4.2
481             - Added methods for parsing/writing hybrid OpenURLs
482             0.4.1
483             - Timestamps no longer included in default initialization
484             - Added method "init_timestamps" to add timestamps
485             0.4
486             - Initial release
487              
488             =head1 COPYRIGHT
489              
490             Quotes from the OpenURL implementation guidelines are from: http://library.caltech.edu/openurl/
491              
492             Copyright 2004 Tim Brody.
493              
494             This module is released under the same terms as the main Perl distribution.
495              
496             =head1 AUTHOR
497              
498             Tim Brody
499             Intelligence, Agents, Multimedia Group
500             University of Southampton, UK
501              
502             =back
503              
504             =cut
505              
506             package URI::OpenURL::entity;
507              
508 5     5   41 use vars qw(@ISA);
  5         10  
  5         342  
509             @ISA = qw(URI::OpenURL);
510              
511 5     5   30 use vars qw( %ENTITIES );
  5         9  
  5         5964  
512              
513             %ENTITIES = (
514             referent => 'rft',
515             referringEntity => 'rfe',
516             serviceType => 'svc',
517             requester => 'req',
518             resolver => 'res',
519             referrer => 'rfr',
520             );
521              
522             sub _entity {
523 17     17   31 my $entity = ref(shift());
524 17         76 $entity =~ s/.*:://;
525 17         50 $ENTITIES{$entity};
526             }
527              
528             sub _addattr {
529 10     10   28 my ($self,@pairs) = @_;
530 10         81 my @KEVS = $self->query_form();
531 10         66 my $entity = _entity($self);
532 10         36 for( my $i = 0; $i < @pairs; $i+=2 ) {
533 7 50 33     56 next unless defined($pairs[$i+1]) && length($pairs[$i+1]);
534 7         34 push @KEVS, $entity.'_'.$pairs[$i], $pairs[$i+1];
535             }
536 10         30 $self->query_form(@KEVS);
537 10         159 $self;
538             }
539              
540             sub _addkevs {
541 5     5   29 my ($self,$val_fmt,@pairs) = @_;
542 5         12 my @KEVS = $self->query_form();
543 5         31 my $entity = _entity($self);
544 5 50       25 push @KEVS, $entity.'_val_fmt', $val_fmt if $val_fmt;
545 5         17 for( my $i = 0; $i < @pairs; $i+=2 ) {
546 20 50 33     95 next unless defined($pairs[$i+1]) && length($pairs[$i+1]);
547 20         85 push @KEVS, $entity.'.'.$pairs[$i], $pairs[$i+1];
548             }
549 5         18 $self->query_form(@KEVS);
550 5         48 bless $self, 'URI::OpenURL'; # Should catch some broken user code
551             }
552              
553             sub dublinCore {
554 0     0   0 shift->_addkevs('info:ofi/fmt:kev:mtx:dc',@_);
555             }
556              
557             sub book {
558 0     0   0 shift->_addkevs('info:ofi/fmt:kev:mtx:book',@_);
559             }
560              
561             sub dissertation {
562 0     0   0 shift->_addkevs('info:ofi/fmt:kev:mtx:dissertation',@_);
563             }
564              
565             sub journal {
566 3     3   18 shift->_addkevs('info:ofi/fmt:kev:mtx:journal',@_);
567             }
568              
569             sub patent {
570 0     0   0 shift->_addkevs('info:ofi/fmt:kev:mtx:patent',@_);
571             }
572              
573             sub scholarlyService {
574 1     1   8 shift->_addkevs('info:ofi/fmt:kev:mtx:sch_svc',@_);
575             }
576              
577             # Descriptors (things with '_' in)
578             sub descriptors {
579 0     0   0 my $self = shift;
580 0 0       0 $self->_addattr(@_) if @_;
581 0 0       0 return () unless wantarray;
582 0         0 my $entity = $self->_entity();
583 0         0 my @pairs = $self->query_form();
584 0         0 my @md;
585 0         0 for(my $i = 0; $i < @pairs; $i+=2) {
586 0 0       0 if( $pairs[$i] =~ s/^$entity\_// ) {
587 0         0 push @md, $pairs[$i], $pairs[$i+1];
588             }
589             }
590 0         0 return @md;
591             }
592              
593             sub descriptor {
594 1     1   17 my ($self,$key) = splice(@_,0,2);
595 1         5 $self->_addattr($key => $_) for @_;
596 1         4 my @KEVS = $self->query_form();
597 1         16 my @VALS;
598 1         10 my $entity = $self->_entity();
599 1         6 for(my $i = 0; $i < @KEVS; $i+=2) {
600 29 100       93 push @VALS, $KEVS[$i+1] if( $KEVS[$i] eq "${entity}_${key}" );
601             }
602 1 50       13 wantarray ? @VALS : $VALS[0];
603             }
604              
605 0     0   0 sub dat { shift->descriptor('dat',@_) }
606 1     1   14 sub id { shift->descriptor('id',@_) }
607 0     0   0 sub ref { shift->descriptor('ref',@_) }
608 0     0   0 sub ref_fmt { shift->descriptor('ref_fmt',@_) }
609 0     0   0 sub val_fmt { shift->descriptor('val_fmt',@_) }
610              
611             # By-value metadata (things with '.' in)
612             sub metadata {
613 2     2   4 my $self = shift;
614 2 100       13 $self->_addkevs(@_) if @_;
615 2 100       14 return () unless wantarray;
616 1         3 my $entity = $self->_entity();
617 1         4 my @pairs = $self->query_form();
618 1         12 my @md;
619 1         5 for(my $i = 0; $i < @pairs; $i+=2) {
620 29 100       107 if( $pairs[$i] =~ s/^$entity\.// ) {
621 8         28 push @md, $pairs[$i], $pairs[$i+1];
622             }
623             }
624 1         22 return @md;
625             }
626              
627             package URI::OpenURL::referent;
628              
629 5     5   46 use vars qw(@ISA);
  5         24  
  5         320  
630             @ISA = qw(URI::OpenURL::entity);
631              
632             package URI::OpenURL::referringEntity;
633              
634 5     5   65 use vars qw(@ISA);
  5         16  
  5         258  
635             @ISA = qw(URI::OpenURL::entity);
636              
637             package URI::OpenURL::requester;
638              
639 5     5   22 use vars qw(@ISA);
  5         15  
  5         268  
640             @ISA = qw(URI::OpenURL::entity);
641              
642             package URI::OpenURL::serviceType;
643              
644 5     5   23 use vars qw(@ISA);
  5         8  
  5         260  
645             @ISA = qw(URI::OpenURL::entity);
646              
647             package URI::OpenURL::resolver;
648              
649 5     5   23 use vars qw(@ISA);
  5         8  
  5         338  
650             @ISA = qw(URI::OpenURL::entity);
651              
652             package URI::OpenURL::referrer;
653              
654 5     5   34 use vars qw(@ISA);
  5         13  
  5         284  
655             @ISA = qw(URI::OpenURL::entity);
656              
657             1;
658