Deutsch   English   Français   Italiano  
<t6597v$mr2$1@shakotay.alphanet.ch>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!eternal-september.org!reader02.eternal-september.org!aioe.org!news.alphanet.ch!alphanet.ch!.POSTED!not-for-mail
From: Marc SCHAEFER <schaefer@alphanet.ch>
Newsgroups: fr.comp.usenet.serveurs
Subject: Re: Champ cancel-lock multiligne
Date: Thu, 19 May 2022 11:21:36 -0000 (UTC)
Organization: Posted through ALPHANET
Message-ID: <t6597v$mr2$1@shakotay.alphanet.ch>
References: <t5orgk$oqk$1@dont-email.me>   <t62hua$lf6$1@shakotay.alphanet.ch> <t62jeo$r8a$1@rasp.pasdenom.info> <t62o37$ead$1@shakotay.alphanet.ch> <t64l64$p4t$1@rasp.pasdenom.info> <t64seh$trg$1@shakotay.alphanet.ch> <t652iq$p67$1@rasp.pasdenom.info> <t65508$ur6$1@rasp.pasdenom.info> <t6562v$95b$1@shakotay.alphanet.ch> <t6581c$4ad$3@rasp.pasdenom.info> <t65869$nvm$1@dont-email.me> <t6589q$4ad$5@rasp.pasdenom.info> <t658m4$lci$1@shakotay.alphanet.ch> <t658tq$8tj$1@rasp.pasdenom.info>
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
Injection-Date: Thu, 19 May 2022 11:21:36 -0000 (UTC)
Injection-Info: shakotay.alphanet.ch; posting-account="schaefer";
	logging-data="23394"; mail-complaints-to="usenet@alphanet.ch"
User-Agent: tin/2.4.3-20181224 ("Glen Mhor") (UNIX) (Linux/4.19.0-20-amd64 (x86_64))
Cancel-Lock: sha256:PS4pu3YvO9+GqsEsHnro4b3np4Dl0cEn/lr3aPaQ3UU=
Bytes: 3068
Lines: 57

yamo' <yamo@beurdin.invalid> wrote:
> 
>    my %headers;
> #   for my $line(split(/\s*\n/, $headers))    {
>    my $previous;
>    foreach my $line (split(/\s*\n/, $headers)) {

for ou foreach c'est la même chose.

>       if ($line =~ m/^([[:alnum:]-]+):\s+(.*)/) {
>                 $previous = $1;
>       } elsif ($line =~ m/^\s+(.*)/) {
>           if (defined($previous)) {
>              $headers{$previous} .= " " . $1;
>           }
>           else {
>              INN::syslog('notice', 'garbled line: ' . $line);
>           }
>       }
>    }

Par contre, il manque des trucs, voici le code complet:

   my %headers;
   my $previous;
   foreach my $line (split(/\s*\n/, $headers)) {
      if ($line =~ m/^([[:alnum:]-]+):\s+(.*)/) {
         # assuming low/upcase normalisation by INN
         $headers{$1} = $2;
         $previous = $1;
      }
      elsif ($line =~ m/^\s+(.*)/) {
         if (defined($previous)) {
            $headers{$previous} .= " " . $1;
         }
         else {
            INN::syslog('notice', 'garbled line: ' . $line);
         }
      }
   }

(pour tous les entêtes sous la forme Nom: valeur, créer
 l'association Nom => valeur dans %header, mais également
 traiter les lignes de continuation)

La version de base c'était:

   my %headers;
   my $previous;
   for my $line (split(/\s*\n/, $headers)) {
      if ($line =~ m/^([[:alnum:]-]+):\s+(.*)/) {
         # assuming low/upcase normalisation by INN
         $headers{$1} = $2;
      }
   }

(pour tous les entêtes sous la forme Nom: valeur, créer
 l'association Nom => valeur dans %header)