Leser: 1
|< 1 2 >| | 18 Einträge, 2 Seiten |
1
2
3
4
5
6
7
8
9
10
sub open_template {
my $path = shift;
my $data;
if(open(DATA, "< $path")) {
$data = join '', <DATA>;
close DATA;
}
return $data;
}
1
2
3
4
5
6
7
8
9
10
11
sub open_template {
my $path = shift;
my $data;
if(open(DATA, "< $path")) {
local $/;
$data = <DATA>;
close DATA;
}
return $data;
}
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
#!/usr/local/bin/perl
local $| = 1;
use strict;
use warnings;
# --------------------
use lib "$ENV{DOCUMENT_ROOT}/cgi-bin/lib";
use CGI qw(:all);
# --------------------
use vars qw(
$cgi
);
$cgi = new CGI;
my $file = $cgi->upload('file');
if (defined $file) {
my $fname = time;
open (DAT,"> test/$fname") or die 'Error processing file: ',$!;
binmode $file;
binmode(DAT);
my $data_file;
while(read $file,$data_file,1024) {
print DAT $data_file;
}
close(DAT);
# --------------------
print $cgi->header("text/plain"), "File is uploaded";
}
else {
print $cgi->header(),
$cgi->start_html(),
$cgi->h1("Upload"),
$cgi->start_form(),
$cgi->filefield(-name=>'file',
-maxlength=>255),
$cgi->submit(),
$cgi->end_form(),
$cgi->end_html();
}
1;
Quotealso strict hat mir keine warnungen ausgegeben die irgenwas damit zu tun habe.
|< 1 2 >| | 18 Einträge, 2 Seiten |