Thread Letzte 10 Zeilen einer Textdatei ausgeben (73 answers)
Opened by TrioxX at 2006-12-03 12:20

Gast Gast
 2006-12-06 12:17
#9284 #9284
Ich habs nun so probiert:

Code: (dl )
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
package Plugins::TextCommands;
use strict;
use lib qw(/home/www/web33/html/cgi-bin/test/);
use File::ReadBackwards;


return bless({
command_handlers => {
'texts' => \&texts_handler,
},
});

sub texts_handler
{
my($self,$main,$command,$text) = @_;

my @ret=();

my $file = './Variables/messages.log';
my $frb = File::ReadBackwards->new( $file ) or
die "can't read $file $!";

for(0..9)
{

my $output = $main->createOutput(

{

template => 'xyz',

texts => $frb->readline(),

nick => $main->{current_user}{nick},

color => $main->{current_user}{color},

text => $main->toHTML($text),

});
$output->restrictToCurrentRoom;
push @ret,$output;

return \@ret;
}
}


Leider ohne Erfolg ^^ Die Ausgabe ist leer.

View full thread Letzte 10 Zeilen einer Textdatei ausgeben