Thread ein paar fragen - hilfe :/: njaa perl halt ^^ (46 answers)
Opened by Gast at 2005-07-05 21:49

renee
 2005-07-14 23:10
#5203 #5203
User since
2003-08-04
14371 Artikel
ModeratorIn
[Homepage] [default_avatar]
Wenn das einfacher Text ist und Du das in HTML ausgibst, dann werden die Leerzeilen nicht angezeigt...

Skript:
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
#!/usr/bin/perl -w
use strict;
use CGI;
use CGI::Carp qw(fatalsToBrowser);


my $cgi = CGI->new();
print $cgi->header();

unless($cgi->param('id')){
print qq~<html><head><title>Logfile </title></head><body>
<form action ="/cgi-bin/comments.pl" method="post">
<p><b> Logfilename eingeben </b> <br>
<p><select name="Logfilename"><option>logfile-accesspoint-1.txt</option>
<option>logfile-accesspoint-2.txt</option></select> <br>
<p> <input type='hidden' name ="id" value='1' > </p>
<p> <input type="submit" value="Ok" > </p>
</form>
</body></html>~;
exit(0);
}

my $a = "logfile-accesspoint-1.txt";
my $b = "logfile-accesspoint-2.txt";

my $file= $cgi->param("Logfilename");

if($file eq $a) {
logfile($a);
}
elsif($file eq $b) {
logfile($b);
}

sub logfile {
my ($file) = @_;
open(LOGFILE1, "<$file") or die "kann $f nicht oeffnen: $!\n";
while(<LOGFILE1>) {
next if(/^\s*?$/); # überspringe Leerzeilen... (für Reguläre Ausdrücke siehe perldoc perlre)
print;
}
close LOGFILE1;
}
OTRS-Erweiterungen (http://feature-addons.de/)
Frankfurt Perlmongers (http://frankfurt.pm/)
--

Unterlagen OTRS-Workshop 2012: http://otrs.perl-services.de/workshop.html
Perl-Entwicklung: http://perl-services.de/

View full thread ein paar fragen - hilfe :/: njaa perl halt ^^