| 1 | package HTTP::OAI::Repository; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||
| 3 | 11 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 4 | 11 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||
| 6 | 11 | ▶ | use vars qw(@ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 7 | 11 | require Exporter; | |||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||
| 9 | 11 | our $VERSION = '4.13'; | |||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||
| 11 | 11 | @ISA = qw(Exporter); | |||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||
| 13 | 11 | @EXPORT = qw(); | |||||||||||||||||||||||||||||||||||||||||
| 14 | 11 | @EXPORT_OK = qw( &validate_request &validate_request_1_1 &validate_date &validate_metadataPrefix &validate_responseDate &validate_setSpec ); | |||||||||||||||||||||||||||||||||||||||||
| 15 | 11 | %EXPORT_TAGS = (validate=>[qw(&validate_request &validate_date &validate_metadataPrefix &validate_responseDate &validate_setSpec)]); | |||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||
| 17 | 11 | ▶ | use HTTP::OAI::Error qw(%OAI_ERRORS); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||
| 19 | # Copied from Simeon Warner's tutorial at | ||||||||||||||||||||||||||||||||||||||||||
| 20 | # http://library.cern.ch/HEPLW/4/papers/3/OAIServer.pm | ||||||||||||||||||||||||||||||||||||||||||
| 21 | # (note: corrected grammer for ListSets) | ||||||||||||||||||||||||||||||||||||||||||
| 22 | # 0 = optional, 1 = required, 2 = exclusive | ||||||||||||||||||||||||||||||||||||||||||
| 23 | my %grammer = ( | ||||||||||||||||||||||||||||||||||||||||||
| 24 | 'GetRecord' => | ||||||||||||||||||||||||||||||||||||||||||
| 25 | { | ||||||||||||||||||||||||||||||||||||||||||
| 26 | 'identifier' => [1, \&validate_identifier], | ||||||||||||||||||||||||||||||||||||||||||
| 27 | 'metadataPrefix' => [1, \&validate_metadataPrefix] | ||||||||||||||||||||||||||||||||||||||||||
| 28 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 29 | 'Identify' => {}, | ||||||||||||||||||||||||||||||||||||||||||
| 30 | 'ListIdentifiers' => | ||||||||||||||||||||||||||||||||||||||||||
| 31 | { | ||||||||||||||||||||||||||||||||||||||||||
| 32 | 'from' => [0, \&validate_date], | ||||||||||||||||||||||||||||||||||||||||||
| 33 | 'until' => [0, \&validate_date], | ||||||||||||||||||||||||||||||||||||||||||
| 34 | 'set' => [0, \&validate_setSpec_2_0], | ||||||||||||||||||||||||||||||||||||||||||
| 35 | 'metadataPrefix' => [1, \&validate_metadataPrefix], | ||||||||||||||||||||||||||||||||||||||||||
| 36 | 0 | ▶ | 'resumptionToken' => [2, sub { 0 }] | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 37 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 38 | 'ListMetadataFormats' => | ||||||||||||||||||||||||||||||||||||||||||
| 39 | { | ||||||||||||||||||||||||||||||||||||||||||
| 40 | 'identifier' => [0, \&validate_identifier] | ||||||||||||||||||||||||||||||||||||||||||
| 41 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 42 | 'ListRecords' => | ||||||||||||||||||||||||||||||||||||||||||
| 43 | { | ||||||||||||||||||||||||||||||||||||||||||
| 44 | 'from' => [0, \&validate_date], | ||||||||||||||||||||||||||||||||||||||||||
| 45 | 'until' => [0, \&validate_date], | ||||||||||||||||||||||||||||||||||||||||||
| 46 | 'set' => [0, \&validate_setSpec_2_0], | ||||||||||||||||||||||||||||||||||||||||||
| 47 | 'metadataPrefix' => [1, \&validate_metadataPrefix], | ||||||||||||||||||||||||||||||||||||||||||
| 48 | 0 | ▶ | 'resumptionToken' => [2, sub { 0 }] | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 49 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 50 | 'ListSets' => | ||||||||||||||||||||||||||||||||||||||||||
| 51 | { | ||||||||||||||||||||||||||||||||||||||||||
| 52 | 0 | ▶ | 'resumptionToken' => [2, sub { 0 }] | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||||||||||||||||||||||||||||||||||||||||||
| 53 | } | ||||||||||||||||||||||||||||||||||||||||||
| 54 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||||||||||||||||
| 56 | 0 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 57 | 0 | my ($class,%args) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 58 | 0 | my $self = bless {}, $class; | |||||||||||||||||||||||||||||||||||||||||
| 59 | 0 | $self; | |||||||||||||||||||||||||||||||||||||||||
| 60 | } | ||||||||||||||||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||||||||||||||||
| 62 | 9 | ▶ | sub validate_request { validate_request_2_0(@_); } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
validate_request: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||||||||||||||||
| 64 | 9 | ▶ | sub validate_request_2_0 { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
validate_request_2_0: called CC=20 SCAR=41.6
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 65 | 9 | my %params = @_; | |||||||||||||||||||||||||||||||||||||||||
| 66 | 9 | my $verb = $params{'verb'}; | |||||||||||||||||||||||||||||||||||||||||
| 67 | 9 | delete $params{'verb'}; | |||||||||||||||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||||||||||||||||
| 69 | 9 | my @errors; | |||||||||||||||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||||||||||||||||
| 71 | 9 | ▶ | return (new HTTP::OAI::Error(code=>'badVerb',message=>'No verb supplied')) unless defined $verb; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||||||||||||||||
| 73 | 9 | ▶ | my $grm = $grammer{$verb} or return (new HTTP::OAI::Error(code=>'badVerb',message=>"Unknown verb '$verb'")); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||||||||||||||||
| 75 | 9 | ▶ | if( defined $params{'from'} && defined $params{'until'} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $params{"from"} and defined $params{"until"}
MC/DC0%0/2
defined $params{"from"} and defined $params{"until"}
defined $params{"from"}
defined $params{"until"}
Truth table66%2/3
A and B
A= defined $params{"from"}B= defined $params{"until"}
| |||||||||||||||||||||||||||||||||||||||||||
| 76 | 0 | ▶ | if( granularity($params{'from'}) ne granularity($params{'until'}) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 77 | 0 | return (new HTTP::OAI::Error( | |||||||||||||||||||||||||||||||||||||||||
| 78 | code=>'badArgument', | ||||||||||||||||||||||||||||||||||||||||||
| 79 | message=>'Granularity used in from and until must be the same' | ||||||||||||||||||||||||||||||||||||||||||
| 80 | )); | ||||||||||||||||||||||||||||||||||||||||||
| 81 | } | ||||||||||||||||||||||||||||||||||||||||||
| 82 | } | ||||||||||||||||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||||||||||||||||
| 84 | # Check exclusivity | ||||||||||||||||||||||||||||||||||||||||||
| 85 | 9 | foreach my $arg (keys %$grm) { | |||||||||||||||||||||||||||||||||||||||||
| 86 | 24 | my ($type, $valid_func) = @{$grm->{$arg}}; | |||||||||||||||||||||||||||||||||||||||||
| 87 | 24 | ▶ | next unless ($type == 2 && defined($params{$arg})); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$type == 2 and defined $params{$arg}
MC/DC0%0/2
$type == 2 and defined $params{$arg}
$type == 2
defined $params{$arg}
Truth table66%2/3
A and B
A= $type == 2B= defined $params{$arg}
| |||||||||||||||||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||||||||||||||||
| 89 | 0 | ▶ | if( my $err = &$valid_func($params{$arg}) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 90 | 0 | return (new HTTP::OAI::Error( | |||||||||||||||||||||||||||||||||||||||||
| 91 | code=>'badArgument', | ||||||||||||||||||||||||||||||||||||||||||
| 92 | message=>("Bad argument ($arg): " . $err) | ||||||||||||||||||||||||||||||||||||||||||
| 93 | )); | ||||||||||||||||||||||||||||||||||||||||||
| 94 | } | ||||||||||||||||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||||||||||||||||
| 96 | 0 | delete $params{$arg}; | |||||||||||||||||||||||||||||||||||||||||
| 97 | 0 | ▶ | if( %params ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 98 | 0 | for(keys %params) { | |||||||||||||||||||||||||||||||||||||||||
| 99 | 0 | push @errors, new HTTP::OAI::Error( | |||||||||||||||||||||||||||||||||||||||||
| 100 | code=>'badArgument', | ||||||||||||||||||||||||||||||||||||||||||
| 101 | message=>"'$_' can not be used in conjunction with $arg" | ||||||||||||||||||||||||||||||||||||||||||
| 102 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 103 | } | ||||||||||||||||||||||||||||||||||||||||||
| 104 | 0 | return @errors; | |||||||||||||||||||||||||||||||||||||||||
| 105 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 106 | 0 | return (); | |||||||||||||||||||||||||||||||||||||||||
| 107 | } | ||||||||||||||||||||||||||||||||||||||||||
| 108 | } | ||||||||||||||||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||||||||||||||||
| 110 | # Check required/optional | ||||||||||||||||||||||||||||||||||||||||||
| 111 | 9 | foreach my $arg (keys %$grm) { | |||||||||||||||||||||||||||||||||||||||||
| 112 | 24 | my ($type, $valid_func) = @{$grm->{$arg}}; | |||||||||||||||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||||||||||||||||
| 114 | 24 | ▶ | if( $params{$arg} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 115 | 7 | ▶ | if( my $err = &$valid_func($params{$arg}) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 116 | 0 | return (new HTTP::OAI::Error(code=>'badArgument',message=>"Bad argument ($arg): " . $err)) | |||||||||||||||||||||||||||||||||||||||||
| 117 | } | ||||||||||||||||||||||||||||||||||||||||||
| 118 | } | ||||||||||||||||||||||||||||||||||||||||||
| 119 | 24 | ▶ | if( $type == 1 && (!defined($params{$arg}) || $params{$arg} eq '') ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%3/6
$type == 1 and !defined($params{$arg}) || $params{$arg} eq ""
not defined $params{$arg} or $params{$arg} eq ""
MC/DC0%0/3
$type == 1 and !defined($params{$arg}) || $params{$arg} eq ""
$type == 1
not defined $params{$arg}
$params{$arg} eq ""
Truth table50%2/4
A and not(B) or C
A= $type == 1B= not defined $params{$arg}C= $params{$arg} eq ""
| |||||||||||||||||||||||||||||||||||||||||||
| 120 | 0 | return (new HTTP::OAI::Error(code=>'badArgument',message=>"Required argument '$arg' was undefined")); | |||||||||||||||||||||||||||||||||||||||||
| 121 | } | ||||||||||||||||||||||||||||||||||||||||||
| 122 | 24 | delete $params{$arg}; | |||||||||||||||||||||||||||||||||||||||||
| 123 | } | ||||||||||||||||||||||||||||||||||||||||||
| 124 | |||||||||||||||||||||||||||||||||||||||||||
| 125 | 9 | ▶ | if( %params ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 126 | 0 | for(keys %params) { | |||||||||||||||||||||||||||||||||||||||||
| 127 | 0 | push @errors, new HTTP::OAI::Error( | |||||||||||||||||||||||||||||||||||||||||
| 128 | code=>'badArgument', | ||||||||||||||||||||||||||||||||||||||||||
| 129 | message=>"'$_' is not a recognised argument for $verb" | ||||||||||||||||||||||||||||||||||||||||||
| 130 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 131 | } | ||||||||||||||||||||||||||||||||||||||||||
| 132 | 0 | return @errors; | |||||||||||||||||||||||||||||||||||||||||
| 133 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 134 | 9 | return (); | |||||||||||||||||||||||||||||||||||||||||
| 135 | } | ||||||||||||||||||||||||||||||||||||||||||
| 136 | } | ||||||||||||||||||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||||||||||||||||
| 138 | 0 | ▶ | sub granularity { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
granularity: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 139 | 0 | my $date = shift; | |||||||||||||||||||||||||||||||||||||||||
| 140 | 0 | ▶ | return 'year' if $date =~ /^\d{4}-\d{2}-\d{2}$/; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 141 | 0 | ▶ | return 'seconds' if $date =~ /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z$/; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 142 | } | ||||||||||||||||||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||||||||||||||||
| 144 | 1 | ▶ | sub validate_date { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
validate_date: called CC=8 SCAR=25.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 145 | 1 | my $date = shift; | |||||||||||||||||||||||||||||||||||||||||
| 146 | 1 | ▶ | return "Date not in OAI format (yyyy-mm-dd or yyyy-mm-ddThh:mm:ssZ)" unless $date =~ /^(\d{4})-(\d{2})-(\d{2})(T\d{2}:\d{2}:\d{2}Z)?$/; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 147 | 1 | ▶ | my( $y, $m, $d ) = ($1,($2||1),($3||1)); | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%2/4
$2 || 1
$3 || 1
MC/DC0%0/1
$2 || 1
$2
MC/DC0%0/1
$3 || 1
$3
Truth table50%1/2
A
A= $2
Truth table50%1/2
A
A= $3
| |||||||||||||||||||||||||||||||||||||||||||
| 148 | 1 | ▶ | return "Month in date is not in range 1-12" if ($m < 1 || $m > 12); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$m < 1 or $m > 12
MC/DC0%0/2
$m < 1 or $m > 12
$m < 1
$m > 12
Truth table33%1/3
A or B
A= $m < 1B= $m > 12
| |||||||||||||||||||||||||||||||||||||||||||
| 149 | 1 | ▶ | return "Day in date is not in range 1-31" if ($d < 1 || $d > 31); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$d < 1 or $d > 31
MC/DC0%0/2
$d < 1 or $d > 31
$d < 1
$d > 31
Truth table33%1/3
A or B
A= $d < 1B= $d > 31
| |||||||||||||||||||||||||||||||||||||||||||
| 150 | 1 | 0; | |||||||||||||||||||||||||||||||||||||||||
| 151 | } | ||||||||||||||||||||||||||||||||||||||||||
| 152 | |||||||||||||||||||||||||||||||||||||||||||
| 153 | 0 | ▶ | sub validate_responseDate { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
validate_responseDate: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 154 | return | ||||||||||||||||||||||||||||||||||||||||||
| 155 | 0 | ▶ | shift =~ /^(\d{4})\-([01][0-9])\-([0-3][0-9])T([0-2][0-9]):([0-5][0-9]):([0-5][0-9])[\+\-]([0-2][0-9]):([0-5][0-9])$/ ? | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 156 | 0 : | ||||||||||||||||||||||||||||||||||||||||||
| 157 | "responseDate not in OAI format (yyyy-mm-ddThh:mm:dd:ss[+-]hh:mm)"; | ||||||||||||||||||||||||||||||||||||||||||
| 158 | } | ||||||||||||||||||||||||||||||||||||||||||
| 159 | |||||||||||||||||||||||||||||||||||||||||||
| 160 | 0 | ▶ | sub validate_setSpec { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
validate_setSpec: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 161 | return | ||||||||||||||||||||||||||||||||||||||||||
| 162 | 0 | ▶ | shift =~ /^([A-Za-z0-9])+(:[A-Za-z0-9]+)*$/ ? | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 163 | 0 : | ||||||||||||||||||||||||||||||||||||||||||
| 164 | "Set spec not in OAI format, must match ^([A-Za-z0-9])+(:[A-Za-z0-9]+)*\$"; | ||||||||||||||||||||||||||||||||||||||||||
| 165 | } | ||||||||||||||||||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||||||||||||||||
| 167 | 0 | ▶ | sub validate_setSpec_2_0 { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
validate_setSpec_2_0: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 168 | return | ||||||||||||||||||||||||||||||||||||||||||
| 169 | 0 | ▶ | shift =~ /^([A-Za-z0-9_!'\$\(\)\+\-\.\*])+(:[A-Za-z0-9_!'\$\(\)\+\-\.\*]+)*$/ ? | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 170 | 0 : | ||||||||||||||||||||||||||||||||||||||||||
| 171 | "Set spec not in OAI format, must match ([A-Za-z0-9_!'\\\$\(\\)\\+\\-\\.\\*])+(:[A-Za-z0-9_!'\\$\\(\\)\\+\\-\\.\\*]+)*"; | ||||||||||||||||||||||||||||||||||||||||||
| 172 | } | ||||||||||||||||||||||||||||||||||||||||||
| 173 | |||||||||||||||||||||||||||||||||||||||||||
| 174 | 5 | ▶ | sub validate_metadataPrefix { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
validate_metadataPrefix: called CC=2 SCAR=7.6
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 175 | return | ||||||||||||||||||||||||||||||||||||||||||
| 176 | 5 | ▶ | shift =~ /^[A-Za-z0-9\-_\.!\~\*\'\(\)]+$/ ? | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 177 | 0 : | ||||||||||||||||||||||||||||||||||||||||||
| 178 | "Metadata prefix not in OAI format, must match regexp ^[A-Za-z0-9\\-_\\.!\\~\\*\\'\\(\\)]+\$/"; | ||||||||||||||||||||||||||||||||||||||||||
| 179 | } | ||||||||||||||||||||||||||||||||||||||||||
| 180 | |||||||||||||||||||||||||||||||||||||||||||
| 181 | # OAI 2 requires identifiers by valid URIs | ||||||||||||||||||||||||||||||||||||||||||
| 182 | # This doesn't check for invalid chars, merely <sheme>:<scheme-specific> | ||||||||||||||||||||||||||||||||||||||||||
| 183 | 1 | ▶ | sub validate_identifier { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
validate_identifier: called CC=2 SCAR=7.6
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 184 | return | ||||||||||||||||||||||||||||||||||||||||||
| 185 | 1 | ▶ | shift =~ /^[[:alpha:]][[:alnum:]\+\-\.]*:.+/ ? | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 186 | 0 : | ||||||||||||||||||||||||||||||||||||||||||
| 187 | "Identifier not in OAI format, must match regexp ^[[:alpha:]][[:alnum:]\\+\\-\\.]*:.+"; | ||||||||||||||||||||||||||||||||||||||||||
| 188 | } | ||||||||||||||||||||||||||||||||||||||||||
| 189 | |||||||||||||||||||||||||||||||||||||||||||
| 190 | 11 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 191 | |||||||||||||||||||||||||||||||||||||||||||
| 192 | __END__ | ||||||||||||||||||||||||||||||||||||||||||