Главная страница


ru.perl

 
 - RU.PERL ----------------------------------------------------------------------
 From : Andrey Sapozhnikov                   2:5020/400     28 Mar 2002  17:05:34
 To : Victor Wagner
 Subject : Re: Символ возврата каретки
 -------------------------------------------------------------------------------- 
 
 Victor Wagner wrote:
 
 > Линухи этого не понимают только в первой строке. Которая
 > #!/usr/bin/perl
 > И пытаются выполнить файл с именем "perl\r"
 > 
 > В самом скрипте perl это прекрасно понимает.
 
 Очень зависит от версии и ключей при компиляции самого Perl.
 До 5.004 это была фатальная ошибка. Подробней:
 
 perldoc perl5004delta
 ...
         Illegal character %s (carriage return)
             (F) A carriage return character was found in the
             input.  This is an error, and not a warning, because
             carriage return characters can break multi-line
             strings, including here documents (e.g., "print
             <<EOF;").
 
 ...
 
 perldoc perl5005delta
 ...
         More generous treatment of carriage returns
 
         Perl used to complain if it encountered literal carriage
         returns in scripts.  Now they are mostly treated like
         whitespace within program text.  Inside string literals
         and here documents, literal carriage returns are ignored
         if they occur paired with linefeeds, or get interpreted as
         whitespace if they stand alone.  This behavior means that
         literal carriage returns in files should be avoided.  You
         can get the older, more compatible (but less generous)
         behavior by defining the preprocessor symbol
         "PERL_STRICT_CR" when building perl.  Of course, all this
         has nothing whatever to do with how escapes like "\r" are
         handled within strings.
 
         Note that this doesn't somehow magically allow you to keep
         all text files in DOS format.  The generous treatment only
         applies to files that perl itself parses.  If your C comЅ
         piler doesn't allow carriage returns in files, you may
         still be unable to build modules that need a C compiler.
 ...
 
 perldoc perldelta (для 5.6.1)
 ...
         Scripts are read in binary mode by default to allow
         ByteLoader (and the filter mechanism in general) to work
         properly.  For compatibility, the DATA filehandle will be
         set to text mode if a carriage return is detected at the
         end of the line containing the __END__ or __DATA__ token;
         if not, the DATA filehandle will be left open in binary
         mode.  Earlier versions always opened the DATA filehandle
         in text mode.
 ...
 perldoc perldiag (для 5.6.1)
 ...
         Illegal character %s (carriage return)
             (F) Perl normally treats carriage returns in the proЅ
             gram text as it would any other whitespace, which
             means you should never see this error when Perl was
             built using standard options.  For some reason, your
             version of Perl appears to have been built without
             this support.  Talk to your Perl administrator.
 ...
 
 Андрей
 --- ifmail v.2.15dev5
  * Origin: Demos online service (2:5020/400)
 
 

Вернуться к списку тем, сортированных по: возрастание даты  уменьшение даты  тема  автор 

 Тема:    Автор:    Дата:  
 Символ возврата каретки   Antuan March   28 Mar 2002 14:54:26 
 Re: Символ возврата каретки   Victor Wagner   28 Mar 2002 16:34:33 
 Символ возврата каретки   kan   04 Apr 2002 22:50:33 
 Re: Символ возврата каретки   Andrey Sapozhnikov   28 Mar 2002 17:05:34 
 Re: Символ возврата каретки   Victor Wagner   28 Mar 2002 20:25:23 
 Re: Символ возврата каретки   Andrey Sapozhnikov   28 Mar 2002 23:02:54 
 Re: Символ возврата каретки   Andrey Sapozhnikov   28 Mar 2002 16:40:45 
 Символ возврата каретки   Antuan March   31 Mar 2002 22:12:24 
 Re: Символ возврата каретки   Vladimir Podgorny   28 Mar 2002 16:44:50 
 Re: Символ возврата каретки   Andrew Baroho   28 Mar 2002 18:30:09 
 Re: Символ возврата каретки   Alexander V. Artemyev   28 Mar 2002 19:09:18 
 Символ возврата каретки   Antuan March   28 Mar 2002 23:40:38 
Архивное /ru.perl/528419a468da.html, оценка 2 из 5, голосов 10
Яндекс.Метрика
Valid HTML 4.01 Transitional