This file is indexed.

/usr/share/doc/kildclient/html/apes02.xhtml is in kildclient-doc 3.2.0-2.

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
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml"><head><title>E.2. A Sample Plugin</title><link rel="stylesheet" type="text/css" href="docbook.css"/><link rel="stylesheet" type="text/css" href="kildclient.css"/><meta name="generator" content="DocBook XSL Stylesheets V1.79.1"/><link rel="prev" href="apes01.xhtml" title="E.1. The File Format"/><link rel="next" href="apes03.xhtml" title="E.3. Disposing Data When the Plugin Is Unloaded"/></head><body><header><div class="navheader"><table style="width: 100%; "><tr><th style="text-align: center; " colspan="3">E.2. A Sample Plugin</th></tr><tr><td style="width: 20%; text-align: left; "><a accesskey="p" href="apes01.xhtml">Prev</a> </td><th style="width: 60%; text-align: center; ">Appendix E. Writing Plugins</th><td style="width: 20%; text-align: right; "> <a accesskey="n" href="apes03.xhtml">Next</a></td></tr></table><hr/></div></header><section class="sect1" id="idm5310"><div class="titlepage"><div><div><h2 class="title" style="clear: both">E.2. A Sample Plugin</h2></div></div></div><p>Here is a simple but complete plugin. It will be used to
illustrate many things about plugins.</p><div class="example" id="idm5314"><div class="example-title">Example E.1. A Sample Plugin</div><div class="example-contents"><pre class="programlisting">
package sample;
#: Version: 1.0
#: Description: A Sample Plugin
#: Author: Eduardo M Kalinowski

$::world-&gt;trigger('First', 'of the plugin', { name =&gt; 'sample:misc' });
$::world-&gt;trigger('Second', 'of the plugin', { name =&gt; 'sample:misc' });

$::world-&gt;timer({ interval =&gt; 5, action =&gt; 'sample plugin',
                  name =&gt; 'sample:misc' });

$::world-&gt;macro('F8', '/sample::stop',  { name =&gt; 'sample:enadis' });
$::world-&gt;macro('F9', '/sample::start', { name =&gt; 'sample:enadis' });


sub testplugin {
  $::world-&gt;echonl("The plugin works.");
}

sub stop {
  $::world-&gt;distimer('sample:misc');
}

sub start {
  $::world-&gt;enatimer('sample:misc');
}

sub help {
  $::world-&gt;echonl("This is a sample plugin, that does nothing useful.");
  $::world-&gt;echonl("It outputs a short string every now and them. This");
  $::world-&gt;echonl("behaviour can be stopped by pressing the F8 key, and");
  $::world-&gt;echonl("re-enabled with the F9 key.");
  $::world-&gt;echonl("One function is defined: sample::testplugin. It");
  $::world-&gt;echonl("outputs something to show that the plugin is working.");
}
</pre></div></div><br class="example-break"/><p>The first thing in the file is the header, in the format
described above. then comes trigger, timer, and macro definitions. All
definitions of triggers, aliases, macros, timers, hook and permanent
variables, if any, should be in the top-level scope (which means they
will be executed when the plugin is loaded). (Alternatively, you could
put them in a <code class="literal">BEGIN</code> block, which would have the
same result, but there isn't a reason for that.) You should not create
any of those objects in any function.</p><p>It should be noted that the <code class="varname">$world</code> variable
is refereed as <code class="varname">$::world</code>. It is just because we are
inside a package, and <code class="varname">$world</code> does not belong to
this package. Otherwise, the calls are equal.</p><p>After that, some functions are defined.
<code class="function">testplugin</code> is meant to be called by the user.
<code class="function">stop</code> and <code class="function">start</code> are used by
the macros (but they could also be called by the user). Finally, a
<code class="function">help</code> is defined, that outputs some information
about the plugin. All plugins should define a
<code class="function">help</code> describing themselves.</p></section><footer><div class="navfooter"><hr/><table style="width: 100%; "><tr><td style="width: 40%; text-align: left; "><a accesskey="p" href="apes01.xhtml">Prev</a> </td><td style="width: 20%; text-align: center; "><a accesskey="u" href="ape.xhtml">Up</a></td><td style="width: 40%; text-align: right; "> <a accesskey="n" href="apes03.xhtml">Next</a></td></tr><tr><td style="width: 40%; text-align: left; vertical-align: top; ">E.1. The File Format </td><td style="width: 20%; text-align: center; "><a accesskey="h" href="index.xhtml">Home</a></td><td style="width: 40%; text-align: right; vertical-align: top; "> E.3. Disposing Data When the Plugin Is Unloaded</td></tr></table></div></footer></body></html>