This file is indexed.

/usr/bin/odf_set_title is in libopenoffice-oodoc-perl 2.125-3.

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

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
#!/usr/bin/perl

eval 'exec /usr/bin/perl  -S $0 ${1+"$@"}'
    if 0; # not running under some shell
#-----------------------------------------------------------------------------
#	$Id : odf_set_title 0.3 2010-01-27 JMG$
#-----------------------------------------------------------------------------

=head1	NAME

odf_set_title - Set the title of a document using the first heading of the content

=head1	USAGE

odf_set_title <filename> <new title>

=head1	SYNOPSIS

This sample script outputs the current title of an ODF file, then it replaces
it using a command line argument as the new title. If the command line doesn't
provide a new title, then the program uses the first heading text in the
document body. If the document doesn't contain any heading element, nothing
is changed.  

=cut
 
use OpenOffice::OODoc	2.112;

my $new_title   = undef;

	# create an ODF file object
	# using the 1st command line argument as filename
my $oofile	= odfContainer($ARGV[0]);
	# exit if $filename isn't available or can't be open
	# as a regular ODF file
die "Unavailable file $ARGV[0]\n" unless $oofile;

	# create a metadata-aware object, linked to the File object
my $doc_meta	= odfMeta(container => $oofile);

	# extract the title form the metadata object
	# (without argument, the 'title' method is a 'get' accessor)
my $title	= $doc_meta->title;

	# if the title is defined, display it and exit
if (defined $title)
	{
	print "The existing title is \"$title\"\n";
	}

if (defined $ARGV[1])
        {
        $new_title = $ARGV[1];
        }
elsif (! defined $title)
	{
	# use the 1st heading of the content
	# create a content-aware object linked to the same container
	my $doc_text	= odfDocument
			(
			container	=> $oofile,
			read_only	=> 'true'
			);
	# get the text of the first heading element
	my $text = $doc_text->getHeadingText(0);
	if ($text)
		{
		# use this text, if defined, as the title
		$new_title = $text;
		}
	else
		{
		# there was no heading in the document,
		# so nothing is done
		warn	"No heading text in the document.\n"	.
			"Nothing is changed.\n";
		}
	}
		
		# the new title (if any) is saved
if (defined $new_title)
	{
	# set the new title
	print "The new title is \"$new_title\"\n";
	$doc_meta->title($new_title);
	# update the revision number
	$doc_meta->increment_editing_cycles;
	# commit the update
	$oofile->save;
	}

exit;