Branch Coverage

lib/Data/Identifier.pm
Criterion Covered Total %
branch 113 310 36.4


line true false branch
315 0 1219 unless defined $type
316 0 1219 unless defined $id
318 97 1122 if (not ref $type and $type eq "from")
319 0 97 if (ref $id) { }
321 0 0 if ($id->isa('Data::Identifier')) { }
0 0 elsif ($id->isa('URI')) { }
0 0 elsif ($id->isa('Mojo::URL')) { }
0 0 elsif ($id->isa('Data::URIID::Result')) { }
0 0 elsif ($id->isa('Data::URIID::Base') or $id->isa('Data::URIID::Colour') or $id->isa('Data::URIID::Service')) { }
0 0 elsif ($id->isa('Data::TagDB::Tag')) { }
0 0 elsif ($id->isa('File::FStore::File') or $id->isa('File::FStore::Adder') or $id->isa('File::FStore::Base')) { }
0 0 elsif ($id->isa('SIRTX::Datecode')) { }
0 0 elsif ($id->isa('Business::ISBN')) { }
0 0 elsif ($id->isa('Data::Identifier::Interface::Simple')) { }
322 0 0 if (scalar keys %opts) { }
351 0 0 unless (scalar keys %opts)
374 923 296 if (not ref $type and $type eq "ise")
375 0 923 unless defined $id
377 923 0 if ($id =~ /^[0-9a-fA-F]{8}-(?:[0-9a-fA-F]{4}-){3}[0-9a-fA-F]{12}$/u) { }
0 0 elsif ($id =~ /^[0-2](?:\.(?:0|[1-9][0-9]*))+\z/u) { }
0 0 elsif ($id =~ /^[a-zA-Z][a-zA-Z0-9\+\.\-]+:/u) { }
381 7 916 if (not defined $type and $id eq "8be115d2-dc2f-4a98-91e1-a6e3075cbc31")
394 197 1022 unless (ref $type)
395 6 191 if ($type =~ /^[0-9a-fA-F]{8}-(?:[0-9a-fA-F]{4}-){3}[0-9a-fA-F]{12}$/u) { }
8 183 elsif ($type eq 'wellknown') { }
400 0 8 unless defined $self
405 0 189 unless defined $type
408 0 1211 unless $type->isa(__PACKAGE__)
411 3 1208 if ($type == ($well_known{'uri'} // 0))
414 1 2 if ($uri =~ /^urn:uuid:([0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12})$/u) { }
0 2 elsif ($uri =~ /^urn:oid:([0-2](?:\.(?:0|[1-9][0-9]*))+)$/u) { }
0 2 elsif ($uri =~ m[^https?://www\.wikidata\.org/entity/([QPL][1-9][0-9]*)$]u) { }
0 2 elsif ($uri =~ m[^https?://doi\.org/(10\..+)$]u) { }
2 0 elsif ($uri =~ m[^https?://uriid\.org/([^/]+)/[^/]+]u) { }
428 2 0 if (defined $uuid_org_to_uuid{$ptype} or $ptype =~ /^[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}\z/u)
431 2 0 if (scalar @path_segments == 3 and $path_segments[0] eq "")
439 1131 80 if ($type == ($well_known_uuid // 0)) { }
1 79 elsif ($type == ($well_known{'oid'} // 0)) { }
442 1 0 if ($id =~ /^2\.25\.([1-9][0-9]*)$/u)
452 594 617 if (defined(my $v = $registered{$type->uuid}{$id}))
457 608 9 if (defined $type->{'validate'})
458 0 608 unless $id =~ /$type->{'validate'}/u
465 3474 228 unless defined $opts{$key}
470 31 1203 if (defined(my $v = $self->{$key}))
471 31 0 unless (ref $v)
477 0 617 if (defined(my $tagname = $opts{'tagname'}))
478 0 0 unless ref $tagname
480 0 0 if (scalar @{$tagname;})
494 0 0 if (ref $type)
495 0 0 if ($type == $well_known_uuid) { }
502 0 0 if ($type ne "ise" and $type ne "uuid")
537 0 7777 if not $opts{'no_defaults'} and defined $self->{'id_cache'} and defined $self->{'id_cache'}{'8be115d2-dc2f-4a98-91e1-a6e3075cbc31'}
539 7805 27 if ($self->{'type'} == $well_known_uuid)
543 3 24 unless ($opts{'no_defaults'})
546 3 0 if defined $self->{'id_cache'} and defined $self->{'id_cache'}{'8be115d2-dc2f-4a98-91e1-a6e3075cbc31'}
549 24 0 if exists $opts{'default'}
557 488 492 if not $opts{'no_defaults'} and defined $self->{'id_cache'} and defined $self->{'id_cache'}{'d08dc905-bbf6-4183-b219-67723c3c8374'}
559 0 492 if ($self->{'type'} == $type)
563 492 0 unless ($opts{'no_defaults'})
564 492 0 if (defined(my $uuid = $self->uuid("default", undef)))
569 0 0 if exists $opts{'default'}
577 488 492 if (not $opts{'no_defaults'} || defined $opts{'style'} and defined $self->{'id_cache'} and defined $self->{'id_cache'}{'a8d1637d-af19-49e9-9ef8-6bc1fbcf6439'})
581 0 493 if ($self->{'type'} == $type)
587 493 0 unless ($opts{'no_defaults'})
588 0 493 if ($self->{'type'} == $well_known{'wd'}) { }
0 493 elsif ($self->{'type'} == $well_known{'doi'}) { }
492 1 elsif (defined(my $uuid = $self->uuid('default', undef)) and $opts{'style'} eq 'urn') { }
0 1 elsif ($enabled_oid and defined(my $oid = $self->oid('default', undef)) and $opts{'style'} eq 'urn') { }
604 0 0 if exists $opts{'default'}
611 625 358 if defined $self->{'id_cache'} and defined $self->{'id_cache'}{'f87a38cb-fd13-4e15-866c-e49901adbec5'}
612 0 358 if ($self->{'type'} == $type)
616 358 0 if exists $opts{'default'}
629 22 0 if ($type == $well_known{'uuid'} or $type == $well_known{'oid'} or $type == $well_known{'uri'}) { }
636 22 0 if defined $value
637 0 0 if $have_default
645 122 6 if $as eq "raw" and defined $opts{'rawtype'}
647 6 122 if (ref $as and eval { do { $as->isa(__PACKAGE__) } })
651 0 6 if $self->type->eq($as)
654 3 21 if ($as == $well_known{$test})
660 3 3 if (defined $next_type) { }
661 0 0 if not $opts{'no_defaults'} and defined $self->{'id_cache'} and defined $self->{'id_cache'}{$type_uuid}
664 3 0 if defined $self->{'id_cache'} and defined $self->{'id_cache'}{$type_uuid}
665 0 0 if exists $opts{'default'}
670 122 3 if $as =~ /^[A-Z]/u || $as =~ /::/u and eval { do { $self->isa($as) } }
672 0 3 if ($self->isa("Data::Identifier::Interface::Subobjects"))
677 0 3 if (defined(my $so = $opts{'so'}))
682 0 3 unless eval { do { $self->isa(__PACKAGE__) } }
684 3 0 if ($as eq 'uuid' or $as eq 'oid' or $as eq 'uri' or $as eq 'sid' or $as eq 'ise') { }
0 0 elsif ($as eq __PACKAGE__) { }
0 0 elsif ($as eq 'URI') { }
0 0 elsif ($as eq 'Mojo::URL') { }
0 0 elsif ($as eq 'Data::URIID::Result' and defined $opts{'extractor'}) { }
0 0 elsif ($as eq 'Data::URIID::Service' and defined $opts{'extractor'}) { }
0 0 elsif ($as eq 'SIRTX::Datecode' and eval { do { require SIRTX::Datecode; 'SIRTX::Datecode'->VERSION(v0.03); 1 } }) { }
0 0 elsif ($as eq 'Data::URIID::Colour' and eval { do { require Data::URIID; require Data::URIID::Colour; 'Data::URIID::Colour'->VERSION(v0.14); 1 } }) { }
0 0 elsif ($as eq 'Data::TagDB::Tag' and defined $opts{'db'}) { }
0 0 elsif ($as eq 'File::FStore::File' and defined $opts{'store'}) { }
0 0 elsif ($as eq 'Business::ISBN' and $self->type->eq('gtin')) { }
694 0 0 if defined $val
695 0 0 if ($had_default)
696 0 0 if ref $default
707 0 0 if defined $val
708 0 0 if ($had_default)
709 0 0 if ref $default
731 0 0 if ($opts{'autocreate'}) { }
741 0 0 if defined $val and $val->is_valid
744 0 0 if exists $opts{'default'}
753 4 78 if (defined $e and not scalar eval { do { $e->isa(__PACKAGE__) } })
754 0 4 if (defined $well_known{$e}) { }
762 41 0 if (defined $self) { }
763 0 41 unless defined $other
764 30 11 if $self == $other
765 0 11 unless $self->type->eq($other->type)
777 0 0 if (defined $e and not scalar eval { do { $e->isa(__PACKAGE__) } })
778 0 0 if (defined $well_known{$e}) { }
786 0 0 if (defined $self) { }
787 0 0 unless defined $other
788 0 0 if $self == $other
789 0 0 if ((my $r = $self->type->cmp($other->type)) != 0)
797 0 0 if (my($sa, $sb) = $self_id =~ /^([^0-9]*)([0-9]+)$/u and my($oa, $ob) = $other_id =~ /^([^0-9]*)([0-9]+)$/u)
799 0 0 if $r
819 0 3 if scalar keys %opts
821 3 0 if defined $self->{'namespace'}
823 0 0 if $has_default
837 0 0 if scalar keys %opts
839 0 0 if defined $self->{'generator'}
841 0 0 if $has_default
854 0 0 if scalar keys %opts
856 0 0 if defined $self->{'request'}
858 0 0 if $has_default
888 13 0 if (defined(my $displayname = $self->{'displayname'}))
889 0 13 if ref $displayname
892 13 0 if defined $displayname and length $displayname
895 0 0 if (defined(my $tagname = $self->tagname("default", undef, "no_defaults", 1)))
899 0 0 unless $opts{'no_defaults'}
900 0 0 if exists $opts{'default'}
918 0 0 if scalar keys %opts
920 0 0 if (defined(my $tagname = $self->{'tagname'}))
921 0 0 if $list
926 0 0 if ($had_default)
927 0 0 if $list
937 15 0 unless defined $opts
938 0 0 unless ref $opts eq "HASH"
940 0 0 if (defined(my $disable = $opts->{'disable'}))
941 0 0 unless ref $disable
943 0 0 if ($to_disable eq 'oid') { }
955 3 0 unless (exists $self->{'_generate'})
958 3 0 if (defined(my $generate = $type->{'generate'}))
959 3 0 unless (ref $generate)
965 3 0 if (defined(my Data::Identifier $ns = eval { do { $type->namespace->uuid } }))
969 3 0 if ($style eq 'id-based') { }
975 3 0 if (defined $input)
987 0 9 if scalar keys %opts
989 8 1 if ($class eq 'wellknown') { }
1 0 elsif ($class eq 'registered' or $class eq ':all') { }