Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #22209 > unrolled thread

perldoc: the key to perl

Started byXah Lee <xahlee@gmail.com>
First post2012-03-26 13:06 -0700
Last post2012-03-26 22:42 +0000
Articles 2 — 2 participants

Back to article view | Back to comp.lang.python


Contents

  perldoc: the key to perl Xah Lee <xahlee@gmail.com> - 2012-03-26 13:06 -0700
    RE: perldoc: the key to perl "Prasad, Ramit" <ramit.prasad@jpmorgan.com> - 2012-03-26 22:42 +0000

#22209 — perldoc: the key to perl

FromXah Lee <xahlee@gmail.com>
Date2012-03-26 13:06 -0700
Subjectperldoc: the key to perl
Message-ID<5a116730-161b-461e-bf0b-4bee038abb3d@z5g2000pbu.googlegroups.com>
〈Perl Documentation: The Key to Perl〉
http://xahlee.org/perl-python/key_to_perl.html

plain text follows
-------------------------------------

So, i wanted to know what the option perl -C does. So, here's perldoc
perlrun. Excerpt:

        -C [*number/list*]
             The -C flag controls some of the Perl Unicode features.

             As of 5.8.1, the -C can be followed either by a number or
a list of
             option letters. The letters, their numeric values, and
effects are
             as follows; listing the letters is equal to summing the
numbers.

                 I     1   STDIN is assumed to be in UTF-8
                 O     2   STDOUT will be in UTF-8
                 E     4   STDERR will be in UTF-8
                 S     7   I + O + E
                 i     8   UTF-8 is the default PerlIO layer for input
streams
                 o    16   UTF-8 is the default PerlIO layer for
output streams
                 D    24   i + o
                 A    32   the @ARGV elements are expected to be
strings encoded
                           in UTF-8
                 L    64   normally the "IOEioA" are unconditional,
                           the L makes them conditional on the locale
environment
                           variables (the LC_ALL, LC_TYPE, and LANG,
in the order
                           of decreasing precedence) -- if the
variables indicate
                           UTF-8, then the selected "IOEioA" are in
effect
                 a   256   Set ${^UTF8CACHE} to -1, to run the UTF-8
caching code in
                           debugging mode.

             For example, -COE and -C6 will both turn on UTF-8-ness on
both
             STDOUT and STDERR. Repeating letters is just redundant,
not
             cumulative nor toggling.

             The "io" options mean that any subsequent open() (or
similar I/O
             operations) in the current file scope will have the
":utf8" PerlIO
             layer implicitly applied to them, in other words, UTF-8
is expected
             from any input stream, and UTF-8 is produced to any
output stream.
             This is just the default, with explicit layers in open()
and with
             binmode() one can manipulate streams as usual.

             -C on its own (not followed by any number or option
list), or the
             empty string "" for the "PERL_UNICODE" environment
variable, has
             the same effect as -CSDL. In other words, the standard I/
O handles
             and the default "open()" layer are UTF-8-fied *but* only
if the
             locale environment variables indicate a UTF-8 locale.
This
             behaviour follows the *implicit* (and problematic) UTF-8
behaviour
             of Perl 5.8.0.

             You can use -C0 (or "0" for "PERL_UNICODE") to explicitly
disable
             all the above Unicode features.

             The read-only magic variable "${^UNICODE}" reflects the
numeric
             value of this setting. This variable is set during Perl
startup and
             is thereafter read-only. If you want runtime effects, use
the
             three-arg open() (see "open" in perlfunc), the two-arg
binmode()
             (see "binmode" in perlfunc), and the "open" pragma (see
open).

             (In Perls earlier than 5.8.1 the -C switch was a Win32-
only switch
             that enabled the use of Unicode-aware "wide system call"
Win32
             APIs. This feature was practically unused, however, and
the command
             line switch was therefore "recycled".)

             Note: Since perl 5.10.1, if the -C option is used on the
"#!" line,
             it must be specified on the command line as well, since
the
             standard streams are already set up at this point in the
execution
             of the perl interpreter. You can also use binmode() to
set the
             encoding of an I/O stream.

reading that is like a adventure. It's like this:

    The -C is a key to unlock many secrets. Just get it, and you'll be
all
    good to go, except in cases you may need the inner key. You'll
find a
    hinge in the key, open it, then there's a subkey. On the subkey,
    there's a number. Take that number to the lock, it will open with
    keyX. When you use keyX, it must be matched with the previous
inner
    key with 8th bit. keyX doesn't have a ID, but you can make one by
    finding the number at the place you found the key C. Key C is
actually
    optional, but when inner key and keyX's number matches, it changes
the
    nature of the lock. This is when you need to turn on keyMode …

 Xah

[toc] | [next] | [standalone]


#22215

From"Prasad, Ramit" <ramit.prasad@jpmorgan.com>
Date2012-03-26 22:42 +0000
Message-ID<mailman.1024.1332802778.3037.python-list@python.org>
In reply to#22209
> 
> 〈Perl Documentation: The Key to Perl〉
> http://xahlee.org/perl-python/key_to_perl.html
> 
> plain text follows
> -------------------------------------
> 
> So, i wanted to know what the option perl -C does. So, here's perldoc
> perlrun. Excerpt:
[snip]

Maybe I missed something, but what does this have to do with Python?

Ramit


Ramit Prasad | JPMorgan Chase Investment Bank | Currencies Technology
712 Main Street | Houston, TX 77002
work phone: 713 - 216 - 5423

--


This email is confidential and subject to important disclaimers and
conditions including on offers for the purchase or sale of
securities, accuracy and completeness of information, viruses,
confidentiality, legal privilege, and legal entity disclaimers,
available at http://www.jpmorgan.com/pages/disclosures/email.  

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web