This file is indexed.

/usr/share/perl5/HTML/HTML5/Microdata/Strategy/Heuristic.pm is in libhtml-html5-microdata-parser-perl 0.100-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
package HTML::HTML5::Microdata::Strategy::Heuristic;

use 5.010;
use strict;
use utf8;

our $AUTHORITY = 'cpan:TOBYINK';
our $VERSION   = '0.100';

use URI::Escape qw[uri_escape];

use base qw[HTML::HTML5::Microdata::Strategy::Basic];

sub make_uri
{
	my ($self=>%params) = @_;
	
	if ($self->is_uri($params{name}))
	{
		return $params{name};
	}
	elsif (not length ($params{type}//''))
	{
		return undef unless $params{prefix_empty};
		return $params{prefix_empty}.uri_escape($params{name});
	}
	
	my ($pfx, $char, $sfx) = $self->_split_on_last($params{type}, '#/');
	
	if ($char eq '#')
	{
		return $pfx . $char . $params{name};
	}

	if ($char eq '/' and $sfx =~ m/^\P{IsUpper}/)
	{
		return $params{type} . '#' . $params{name};
	}
	
	while ('we have nothing better to do')
	{
		if ($self->_is_minimal($pfx))
		{
			last;
		}
		if ($sfx =~ m/^(\P{IsUpper})/)
		{
			$pfx .= $char . $sfx;
			last;
		}
		if ($char ne '/')
		{
			last;
		}
		
		($pfx, $char, $sfx) = $self->_split_on_last($pfx, '/');
	}
	
	return $pfx . '/' . $params{name};
}

sub _is_minimal
{
	my ($self=>$uri) = @_;
	
	if ($uri =~ m/^https?:/i)
	{
		return ($uri =~ m#https?://[^/?]+$#i);
	}

	if ($uri =~ m/^s?ftps?:/i)
	{
		return ($uri =~ m#s?ftps?://[^/]+$#i);
	}

	return 'unknown URI scheme'; # true
}

sub _split_on_last
{
	my ($self=>$string,$chars) = @_;
	
	if ($string =~ m/^ (.*) ([$chars]) ([^$chars]*) $/x)
	{
		return ($1, $2, $3);
	}
	else
	{
		return ($string, undef, undef);
	}
}

1;