]> git.nbdom.net Git - nb.git/commitdiff
lib/perl/NB/CGI.pm
authorNicolas Boisselier <nicolas.boisselier@gmail.com>
Sun, 26 Nov 2023 10:18:39 +0000 (11:18 +0100)
committerNicolas Boisselier <nicolas.boisselier@gmail.com>
Sun, 26 Nov 2023 10:18:39 +0000 (11:18 +0100)
lib/perl/NB/CGI.pm

index fa18070b21eac6abf03c3bf12224544765e8605c..2fc46067f712b24423a3aee5fc78839f18273e47 100644 (file)
@@ -1,8 +1,12 @@
 # NB 22.11.23
 package NB::CGI;
 use strict;
-our $PARAM_UTF8 = 1 unless defined $PARAM_UTF8;
+#our $PARAM_UTF8 = 1 unless defined $PARAM_UTF8;
+#$CGI::PARAM_UTF8 = 1 unless defined $CGI::PARAM_UTF8;
 use parent qw/CGI/;
+$CGI::PARAM_UTF8 = 1;
+#$CGI::PARAM_UTF8 = 1 unless defined $CGI::PARAM_UTF8;
+#&CGI::init;
 &CGI::charset('utf-8') if $CGI::PARAM_UTF8;
 
 my $isTextOutput = 0;
@@ -82,25 +86,40 @@ sub textOutput {{
 }}
 
 sub header {
+  my($self,@p) = &CGI::self_or_default(@_);
   my $status = '200 OK';
 
-  if (!CGI::nph())
+  if (!&CGI::nph())
   {
-       for (my $i=0;$i<@_-1;$i++)
+       for (my $i=0;$i<@p-1;$i++)
        {
-                       next if $_[$i] ne '-status';
-                       $status = $_[$i+1];
-                       splice(@_,$i,2);
+                       next if $p[$i] ne '-status';
+                       $status = $p[$i+1];
+                       splice(@p,$i,2);
        }
   }
+
+  # NB 26.11.23 for (my $i=0;$i<@_-1;$i++)
+  # NB 26.11.23 {
+               # NB 26.11.23 next if $_[$i] ne '-type';
+               # NB 26.11.23 #$status = $_[$i+1];
+               # NB 26.11.23 #splice(@_,$i,2);
+  # NB 26.11.23 }
+
   my @head = ();
        $ENV{SERVER_PROTOCOL} ||= 'HTTP/1.1';
-  push @head,$ENV{SERVER_PROTOCOL}." $status\r\n";
+  #push @head,$ENV{SERVER_PROTOCOL}." $status\r\n";
+  push @head,$ENV{SERVER_PROTOCOL}." $status";
   #delete $_->{'status'};
-  push @head,CGI::header(@_);
-  return join('',@head);
+  push @head,&CGI::header(@p);
+  return join($CGI::CRLF,@head);
 }
 
+# NB 26.11.23 sub init {
+       # NB 26.11.23 &CGI::init;
+       # NB 26.11.23 &CGI::charset('utf-8') if $CGI::PARAM_UTF8;
+# NB 26.11.23 }
+
 sub start_html {
        local $_ = &CGI::start_html(@_);
        s/<!DOCTYPE .*?>/<!DOCTYPE html>/s;