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
#!/usr/bin/perl -w my $dir = "/var/www/mydom.de/htdcos"; use CGI qw/:all/; my $p = path_info; $filename= "$dir/$p"; # weiterer Code #.... #.... #... # mach irgendwas mit $filename #... #...... $res = ""; if ($filename =~ m{$p\.png}) { # is PNG $res = "OK"; } else { $res = "NOT OK!!!"; } print header; print "Upload is ", $res;
1
2
[Thu Feb 13 11:01:30 2012] [error] [client 127.0.0.1] Nested quantifiers in regex; marked by <-- HERE in m//..+++ <-- HERE +a.png\\.png/ at dl.pl line 18.
[Thu Feb 13 11:01:30 2012] [error] [client 127.0.0.1] Premature end of script headers: dl.pl
if ($filename =~ m{\Q$p\E\.png}) { # is PNG
1 2
use URI::Split qw(uri_split uri_join); ($scheme, $auth, $path, $query, $frag) = uri_split($uri);
2012-02-23T12:53:46 GwenDragonEgal wie der Path absplittet wird, wenn der Regexzeichen enthält, knallt es.
Das verwenden von URI:Split ändert aber nix an der Falle von Zeile 21 :P
if ($filename =~ m{\Q$p\E\.png$}) { # is PNG