Branch Coverage

lib/Data/Identifier.pm
Criterion Covered Total %
branch 133 320 41.5


line true false branch
329 0 1243 unless defined $type
330 0 1243 unless defined $id
332 85 1158 if (not ref $type and $type eq "from")
333 8 77 if (ref $id) { }
335 8 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')) { }
0 0 elsif ($id->isa('JSON::PP::Boolean') or $id->isa('JSON::XS::Boolean')) { }
336 0 8 if (scalar keys %opts) { }
365 0 0 unless (scalar keys %opts)
391 931 304 if (not ref $type and $type eq "ise")
392 0 931 unless defined $id
394 923 8 if ($id =~ /^[0-9a-fA-F]{8}-(?:[0-9a-fA-F]{4}-){3}[0-9a-fA-F]{12}\z/u) { }
0 8 elsif ($id =~ /^[0-2](?:\.(?:0|[1-9][0-9]*))+\z/u) { }
8 0 elsif ($id =~ /^[a-zA-Z][a-zA-Z0-9\+\.\-]+:/u) { }
398 7 916 if (not defined $type and $id eq "8be115d2-dc2f-4a98-91e1-a6e3075cbc31")
411 213 1022 unless (ref $type)
412 6 207 if ($type =~ /^[0-9a-fA-F]{8}-(?:[0-9a-fA-F]{4}-){3}[0-9a-fA-F]{12}\z/u) { }
8 199 elsif ($type eq 'wellknown') { }
417 0 8 unless defined $self
422 0 205 unless defined $type
425 0 1227 unless $type->isa(__PACKAGE__)
428 11 1216 if ($type == ($well_known{'uri'} // 0))
431 1 10 if ($uri =~ /^urn:uuid:([0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12})\z/u) { }
0 10 elsif ($uri =~ /^urn:oid:([0-2](?:\.(?:0|[1-9][0-9]*))+)\z/u) { }
0 10 elsif ($uri =~ m[^https?://www\.wikidata\.org/entity/([QPL][1-9][0-9]*)\z]u) { }
0 10 elsif ($uri =~ m[^https?://doi\.org/(10\..+)\z]u) { }
2 8 elsif ($uri =~ m[^https?://uriid\.org/([^/]+)/[^/]+]u) { }
445 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)
448 2 0 if (scalar @path_segments == 3 and $path_segments[0] eq "")
456 1135 92 if ($type == ($well_known_uuid // 0)) { }
1 91 elsif ($type == ($well_known{'oid'} // 0)) { }
459 1 0 if ($id =~ /^2\.25\.([1-9][0-9]*)\z/u)
469 617 610 if (defined(my $v = $registered{$type->uuid}{$id}))
474 601 9 if (defined $type->{'validate'})
475 0 601 unless $id =~ /$type->{'validate'}/u
482 3460 200 unless defined $opts{$key}
487 3 1217 if (defined(my $v = $self->{$key}))
488 3 0 unless (ref $v)
494 0 610 if (defined(my $tagname = $opts{'tagname'}))
496 0 0 unless ref $tagname
499 0 0 if (scalar @{$tagname;})
513 0 0 if (ref $type)
514 0 0 if ($type == $well_known_uuid) { }
521 0 0 if ($type ne "ise" and $type ne "uuid")
556 4 8106 if not $opts{'no_defaults'} and defined $self->{'id_cache'} and defined $self->{'id_cache'}{'8be115d2-dc2f-4a98-91e1-a6e3075cbc31'}
558 8116 45 if ($self->{'type'} == $well_known_uuid)
562 23 22 unless ($opts{'no_defaults'})
565 7 16 if defined $self->{'id_cache'} and defined $self->{'id_cache'}{'8be115d2-dc2f-4a98-91e1-a6e3075cbc31'}
568 38 0 if exists $opts{'default'}
576 522 515 if not $opts{'no_defaults'} and defined $self->{'id_cache'} and defined $self->{'id_cache'}{'d08dc905-bbf6-4183-b219-67723c3c8374'}
578 0 515 if ($self->{'type'} == $type)
582 515 0 unless ($opts{'no_defaults'})
583 507 8 if (defined(my $uuid = $self->uuid("default", undef)))
588 8 0 if exists $opts{'default'}
596 522 515 if (not $opts{'no_defaults'} || defined $opts{'style'} and defined $self->{'id_cache'} and defined $self->{'id_cache'}{'a8d1637d-af19-49e9-9ef8-6bc1fbcf6439'})
600 8 508 if ($self->{'type'} == $type)
606 508 0 unless ($opts{'no_defaults'})
607 4 504 if ($self->{'type'} == $well_known{'wd'}) { }
0 504 elsif ($self->{'type'} == $well_known{'doi'}) { }
503 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') { }
623 0 0 if exists $opts{'default'}
630 635 405 if defined $self->{'id_cache'} and defined $self->{'id_cache'}{'f87a38cb-fd13-4e15-866c-e49901adbec5'}
631 0 405 if ($self->{'type'} == $type)
635 405 0 if exists $opts{'default'}
648 22 0 if ($type == $well_known{'uuid'} or $type == $well_known{'oid'} or $type == $well_known{'uri'}) { }
655 22 0 if defined $value
656 0 0 if $have_default
664 124 6 if $as eq "raw" and defined $opts{'rawtype'}
666 6 124 if (ref $as and eval { do { $as->isa(__PACKAGE__) } })
670 0 6 if $self->type->eq($as)
673 3 21 if ($as == $well_known{$test})
679 3 3 if (defined $next_type) { }
680 0 0 if not $opts{'no_defaults'} and defined $self->{'id_cache'} and defined $self->{'id_cache'}{$type_uuid}
683 3 0 if defined $self->{'id_cache'} and defined $self->{'id_cache'}{$type_uuid}
684 0 0 if exists $opts{'default'}
689 124 3 if $as =~ /^[A-Z]/u || $as =~ /::/u and eval { do { $self->isa($as) } }
691 0 3 if ($self->isa("Data::Identifier::Interface::Subobjects"))
696 0 3 if (defined(my $so = $opts{'so'}))
701 0 3 unless eval { do { $self->isa(__PACKAGE__) } }
703 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')) { }
713 0 0 if defined $val
714 0 0 if ($had_default)
715 0 0 if ref $default
726 0 0 if defined $val
727 0 0 if ($had_default)
728 0 0 if ref $default
750 0 0 if ($opts{'autocreate'}) { }
760 0 0 if defined $val and $val->is_valid
763 0 0 if exists $opts{'default'}
772 4 78 if (defined $e and not scalar eval { do { $e->isa(__PACKAGE__) } })
773 0 4 if (defined $well_known{$e}) { }
781 41 0 if (defined $self) { }
782 0 41 unless defined $other
783 30 11 if $self == $other
784 0 11 unless $self->type->eq($other->type)
796 0 0 if (defined $e and not scalar eval { do { $e->isa(__PACKAGE__) } })
797 0 0 if (defined $well_known{$e}) { }
805 0 0 if (defined $self) { }
806 0 0 unless defined $other
807 0 0 if $self == $other
808 0 0 if ((my $r = $self->type->cmp($other->type)) != 0)
816 0 0 if (my($sa, $sb) = $self_id =~ /^([^0-9]*)([0-9]+)\z/u and my($oa, $ob) = $other_id =~ /^([^0-9]*)([0-9]+)\z/u)
818 0 0 if $r
833 0 0 if scalar @opts
835 0 0 unless defined $self
837 0 0 unless (eval { do { $self->isa(__PACKAGE__) } })
841 0 0 if $self->eq("null")
855 0 7 if scalar keys %opts
857 7 0 if defined $self->{'namespace'}
859 0 0 if $has_default
873 0 0 if scalar keys %opts
875 0 0 if defined $self->{'generator'}
877 0 0 if $has_default
890 0 0 if scalar keys %opts
892 0 0 if defined $self->{'request'}
894 0 0 if $has_default
924 0 13 if (defined(my $displayname = $self->{'displayname'}))
925 0 0 if ref $displayname
928 0 0 if defined $displayname and length $displayname
931 13 0 if (defined(my $tagname = $self->tagname("default", undef, "no_defaults", 1)))
935 0 0 unless $opts{'no_defaults'}
936 0 0 if exists $opts{'default'}
954 0 17 if scalar keys %opts
956 13 4 if (defined(my $tagname = $self->{'tagname'}))
957 0 13 if $list
962 4 0 if ($had_default)
963 4 0 if $list
973 15 0 unless defined $opts
974 0 0 unless ref $opts eq "HASH"
976 0 0 if (defined(my $disable = $opts->{'disable'}))
977 0 0 unless ref $disable
979 0 0 if ($to_disable eq 'oid') { }
991 15 8 unless (exists $self->{'_generate'})
994 7 8 if (defined(my $generate = $type->{'generate'}))
995 7 0 unless (ref $generate)
1001 7 0 if (defined(my Data::Identifier $ns = eval { do { $type->namespace->uuid } }))
1005 7 0 if ($style eq 'id-based') { }
1011 7 0 if (defined $input)
1023 0 9 if scalar keys %opts
1025 8 1 if ($class eq 'wellknown') { }
1 0 elsif ($class eq 'registered' or $class eq ':all') { }