This file is indexed.

/usr/share/perl5/Acme/POE/Knee.pm is in libacme-poe-knee-perl 1.12-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
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
package Acme::POE::Knee;
BEGIN {
  $Acme::POE::Knee::VERSION = '1.12';
}

#ABSTRACT: Time sliced pony race using the POE kernel.

use strict;
use POE;

sub new {
    my $class   = shift;
    my %args    = @_;
    my $self    = { };
    my $data    = {
        dist    => 10,
        ponies  => {
            'dngor'     => 5,
            'Abigail'   => 5.2,
            'Co-Kane'   => 5.4,
            'MJD'       => 5.6,
            'acme'      => 5.8,
        },
    };

    ### check for wrong input ###
    for my $key ( keys %args ) {
        unless( exists $data->{$key} ) {
            print "WARNING! Option $key is not supported in $class!\n";
        }
    }

    ### bless the object into the class ###
    bless $self, $class;

    ### now we start adding the data ###
    for my $key (keys %$data) {
      if ( exists $args{$key} ) {
            $self->{$key} = $args{$key};
        } else {
            $self->{$key} = $data->{$key};
        }
    }

    ### fetch the data ###
    sub dist    { my $self = shift; $self->{dist}     }
    sub ponies  { my $self = shift; $self->{ponies}   }

    return $self;

}

sub _start {
    my ($kernel, $heap, $name, $delay, $dist) = @_[KERNEL, HEAP, ARG0, ARG1, ARG2];

    $heap->{name}   = $name;
    $heap->{delay}  = $delay;
    $heap->{dist}   = $dist;

    printf "Starting pony %10s\n", $heap->{name};
    $kernel->delay_add( run => rand($heap->{delay}) );
}

sub run {
    my ($kernel, $heap) = @_[KERNEL, HEAP];
    printf "Pony %10s has reached stage %3i\n", $heap->{name}, ++$heap->{stage};
    die "$heap->{name} won the race!\n" if $heap->{stage} > $heap->{dist};
    $kernel->delay_add( run => rand($heap->{delay}) );
}

sub race {
    my $self = shift;

    for my $name (@{[keys %{$self->ponies()}]} ) {

        POE::Session->create (
           inline_states => {
               _start  => \&_start,
               run     => \&run,
            },
            args => [ $name, $self->ponies()->{$name}, $self->dist() ],
        );
    }
    $poe_kernel->run();
}

q[POE::Knee!];


__END__
=pod

=head1 NAME

Acme::POE::Knee - Time sliced pony race using the POE kernel.

=head1 VERSION

version 1.12

=head1 SYNOPSIS

    #!/usr/bin/perl -w
    use strict;

    # Use POEny!
    use Acme::POE::Knee;

    # Every Acme::POE::Knee race will require a set of arguments.
    # There are defaults but it's just more fun to set these
    # yourselves. We set a distance the ponies must run and of course
    # we name our race ponies! You'll have to specify the maximum
    # delay a pony can have before reaching the next stage.
    # The lower the delay, the higher the chances are the pony will
    # win the race.

    my $pony = new Acme::POE::Knee (
	      dist   => 20,
        ponies  => {
            'dngor'     => 5,
            'Abigail'   => 5.2,
            'Co-Kane'   => 5.4,
            'MJD'       => 5.6,
            'acme'      => 5.8,
        },
    );

    # start the race
    $pony->race( );

    exit;

=head1 DESCRIPTION

POE::Knee is an acronym of "Pony".  We all like ponies. And wouldn't we
love to race ponies? Well, that's what Acme::POE::Knee is for!

It's great for those friday afternoons at the office, where you wonder
who will pay the beer tab. Whoever 'wins' the race, loses!

You specify a distance the ponies must run, and a maximum delay before
the pony will reach the next step. So, the bigger the delay, the bigger
the distance between multiple ponies can be.

Of course this wouldn't be any fun if we couldn't name the ponies
ourselves. Here, we simply put all our race ponies in an array
reference and the Acme::POE::Knee module will take care of the rest.

=for Pod::Coverage   new
  race
  dist
  ponies
  run

=head1 QUICK LINKS

Please see the samples directory in POE's distribution for several
well-commented sample and tutorial programs.

Please see <http://www.perl.com/pub/2001/01/poe.html> for an excellent,
and more importantly: gradual, introduction to POE.

=head1 USING Acme::POE::Knee

Using Acme::POE::Knee is really easy.
This simple progam would already suffice:

    use strict;
    use Acme::POE::Knee;

    my $pony = new Acme::POE::Knee;
    $pony->race();
    exit;

This will use the defaults of the POE::Knee module, but you can of
course specify your own arguments, as shown in the synopsis.

=head1 The Use of Acme::POE::Knee

Use, yes... Useful? Probably not. This was written in response to a
rather persistent meme on #perl (you know who you are!).
Basicly, we all wanted ponies.
Well folks, here it is.

Its source might be interesting to look at for newcomers to POE to see
how this time slicing works.

=head1 Learning more about POE

=over 2

=item The POE Mailing List

POE has a mailing list at perl.org.  You can receive subscription
information by sending e-mail:

  To: poe-help@perl.org
  Subject: (anything will do)

  The message body is ignored.

All forms of feedback are welcome.

=item The POE Web Site

POE has a web site where the latest development snapshot, along with
the Changes file and other stuff may be found: <http://poe.perl.org/>

=back

=head1 AUTHORS

=over 4

=item *

Jos Boumans <kane@cpan.org>

=item *

Rocco Caputo <rcaputo@cpan.org>

=back

=head1 COPYRIGHT AND LICENSE

This software is copyright (c) 2011 by Jos Boumans.

This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.

=cut