This file is indexed.

/usr/share/perl5/POE/Component/IRC/Cookbook/Translator.pod is in libpoe-component-irc-perl 6.88+dfsg-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
=encoding utf8

=head1 NAME

POE::Component::IRC::Cookbook::Translator - A bot that can translate text

=head1 SYNOPSIS

This bot uses L<POE::Component::Lingua::Translate|POE::Component::Lingua::Translate>
to translate text for channel members. It makes use of the C<BotCommand> plugin
to handle the translate command.

=head1 DESCRIPTION

 #!/usr/bin/env perl

 use strict;
 use warnings;
 use Encode qw(decode);
 use Encode::Guess;
 use IRC::Utils qw(decode_irc parse_user);
 use POE;
 use POE::Component::IRC::State;
 use POE::Component::IRC::Plugin::AutoJoin;
 use POE::Component::IRC::Plugin::BotCommand;
 use POE::Component::Lingua::Translate;

 POE::Session->create(
     package_states => [
         main => [ qw(_start irc_botcmd_trans translated) ]
     ],
     heap => {
        translators => { },
     }
 );

 $poe_kernel->run();

 sub _start {
     my $heap = $_[HEAP];
     my $irc = POE::Component::IRC::State->spawn(
         Nick   => 'translator_bot',
         Server => 'irc.freenode.net',
     );
     $heap->{irc} = $irc;

     $irc->plugin_add('AutoJoin', POE::Component::IRC::Plugin::AutoJoin->new(
         Channels => [ '#test_channel1', '#test_channel2' ]
     ));

     $irc->plugin_add('BotCommand', POE::Component::IRC::Plugin::BotCommand->new(
         Commands => {
            trans => 'Usage: trans <from>,<to> <text>'
         }
     ));

     $irc->yield(register => 'botcmd_trans');
     $irc->yield('connect');
     return;
 }

 sub irc_botcmd_trans {
     my $heap = $_[HEAP];
     my $irc = $heap->{irc};
     my $nick = parse_user( $_[ARG0] );
     my $channel = $_[ARG1];
     my ($from, $to, $text) = split /,|\s+/, $_[ARG2], 3;

     if (!exists $heap->{translators}->{$from . $to}) {
         eval {
             $heap->{translators}->{$from . $to} = POE::Component::Lingua::Translate->new(
                 alias     => $from . $to,
                 back_end  => 'Babelfish',
                 src       => $from,
                 dest      => $to,
             );
         };

         if ($@) {
             $irc->yield(privmsg => $channel, "$nick: There was an error: $@");
             return;
         }
     }

     $poe_kernel->post($from . $to => translate =>
         decode_irc($text),
         {
             channel => $channel,
             nick    => $nick,
         }
     );
     return;
 }

 sub translated {
     my $irc = $_[HEAP]->{irc};
     my ($text, $context, $error) = @_[ARG0, ARG1, ARG2];

     if ($error) {
         $irc->yield(
             'privmsg',
             $context->{channel},
             $context->{nick} . ": There was an error: $error",
         );
         return;
     }

     $irc->yield(
         'privmsg',
         $context->{channel},
         $context->{nick} . ': ' . $text,
     );
     return;
 }

=head1 AUTHOR

Hinrik E<Ouml>rn SigurE<eth>sson, hinrik.sig@gmail.com