]> mj.ucw.cz Git - libucw.git/blobdiff - ucw/perl/UCW/CGI.pm
Heap: Revert changes to HEAP_DELETE, which broke position tracking
[libucw.git] / ucw / perl / UCW / CGI.pm
index c8ec08db22666699ea52207b87372d3561ef8faa..b90b8d2951b2380b657176e9955e7afe3f0428d4 100644 (file)
@@ -1,6 +1,6 @@
 #      Poor Man's CGI Module for Perl
 #
-#      (c) 2002--2010 Martin Mares <mj@ucw.cz>
+#      (c) 2002--2011 Martin Mares <mj@ucw.cz>
 #      Slightly modified by Tomas Valla <tom@ucw.cz>
 #
 #      This software may be freely distributed and used according to the terms
@@ -134,7 +134,7 @@ sub rfc822_deescape($) {
 sub http_get($) {
        my $h = shift @_;
        $h =~ tr/a-z-/A-Z_/;
-       return $ENV{"HTTP_$h"} || $ENV{"$h"};
+       return $ENV{"HTTP_$h"} // $ENV{"$h"};
 }
 
 ### Parsing of Arguments ###
@@ -191,7 +191,7 @@ sub init_args() {
                        exit;
                }
        } else {
-               http_error "405 Method Not Allowed", "Allow: GET, HEAD, PUT";
+               http_error "405 Method Not Allowed", "Allow: GET, HEAD, POST";
        }
 }
 
@@ -204,7 +204,7 @@ sub parse_args($) {                 # CAVEAT: attached files must be defined in the main arg t
 
        for my $a (values %$args) {
                my $r = ref($a->{'var'});
-               defined($a->{'default'}) or $a->{'default'}="";
+               $a->{'default'} //= '';
                if ($r eq 'SCALAR') {
                        ${$a->{'var'}} = $a->{'default'};
                } elsif ($r eq 'ARRAY') {
@@ -345,7 +345,7 @@ sub parse_multipart_form_data() {
 
        # BUG: IE 3.01 on Macintosh forgets to add the "--" at the start of the boundary string
        # as the MIME specs preach. Workaround borrowed from CGI.pm in Perl distribution.
-       my $agent = http_get("User-Agent") || "";
+       my $agent = http_get("User-Agent") // "";
        $boundary = "--$boundary" unless $agent =~ /MSIE\s+3\.0[12];\s*Mac/;
        $boundary = "\r\n$boundary";
        $boundary_len = length($boundary) + 2;