~ubuntu-branches/ubuntu/intrepid/perl-doc-html/intrepid

« back to all changes in this revision

Viewing changes to Locale/Script.html

  • Committer: Bazaar Package Importer
  • Author(s): Roberto C. Sanchez
  • Date: 2008-05-17 20:14:19 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20080517201419-qgbuogq2ckkdisyi
Tags: 5.10.0-2
Supersede botched upload of 5.10.0-1.

Show diffs side-by-side

added added

removed removed

Lines of Context:
54
54
      <h2>Links:</h2>
55
55
      <ul>
56
56
        <li><a href="http://search.cpan.org">CPAN</a></li>
 
57
        <li><a href="http://www.perl.org">Perl.org</a></li>
57
58
        <li><a href="http://www.perl.com">Perl.com</a></li>
58
 
        <li><a href="http://www.perl.org">Perl.org</a></li>
 
59
        <li><a href="http://perlbuzz.com">Perl Buzz</a></li>
 
60
        <li><a href="http://www.perlfoundation.org/perl5/index.cgi">Perl 5 Wiki</a></li>
 
61
        <li><a href="http://jobs.perl.org">Perl Jobs</a></li>
59
62
        <li><a href="http://www.pm.org">Perl Mongers</a></li>
60
63
        <li><a href="http://www.perlmonks.org">Perl Monks</a></li>
61
64
        <li><a href="http://planet.perl.org">Planet Perl</a></li>
65
68
      <ul>
66
69
        <li>Site maintained by<br><a href="http://perl.jonallen.info">Jon Allen</a>
67
70
            (<a href="http://perl.jonallen.info">JJ</a>)</li>
68
 
        <li class="spaced">Last updated on<br>23 April 2006</li>
 
71
        <li class="spaced">Last updated on<br>23 December 2007</li>
69
72
        <li class="spaced">See the <a href="http://perl.jonallen.info/projects/perldoc">project page</a> for
70
73
        more details</li>
71
74
      </ul>
76
79
    <div id="centerContent">
77
80
      <div id="contentHeader">
78
81
        <div id="contentHeaderLeft"><a href="#" onClick="showLeft()">Show navigation</a></div>
79
 
        <div id="contentHeaderCentre">-- Perl 5.8.8 documentation --</div>
 
82
        <div id="contentHeaderCentre">-- Perl 5.10.0 documentation --</div>
80
83
        <div id="contentHeaderRight"><a href="#" onClick="showRight()">Show toolbar</a></div>
81
84
      </div>
82
85
      <div id="breadCrumbs"><a href="../index.html">Home</a> &gt; <a href="../index-modules-A.html">Core modules</a> &gt; <a href="../index-modules-L.html">L</a> &gt; Locale::Script</div>
83
86
      <script language="JavaScript">fromSearch();</script>
84
87
      <div id="contentBody"><div class="title_container"><div class="page_title">Locale::Script</div></div><ul><li><a href="#SYNOPSIS">SYNOPSIS</a><li><a href="#DESCRIPTION">DESCRIPTION</a><ul><li><a href="#SPECIAL-CODES">SPECIAL CODES</a></ul><li><a href="#CONVERSION-ROUTINES">CONVERSION ROUTINES</a><li><a href="#QUERY-ROUTINES">QUERY ROUTINES</a><li><a href="#EXAMPLES">EXAMPLES</a><li><a href="#KNOWN-BUGS-AND-LIMITATIONS">KNOWN BUGS AND LIMITATIONS</a><li><a href="#SEE-ALSO">SEE ALSO</a><li><a href="#AUTHOR">AUTHOR</a><li><a href="#COPYRIGHT">COPYRIGHT</a></ul><a name="SYNOPSIS"></a><h1>SYNOPSIS</h1>
85
 
<pre class="verbatim">    <a class="l_k" href="../functions/use.html">use</a> <a class="l_w" href="../Locale/Script.html">Locale::Script</a><span class="sc">;</span>
86
 
    <a class="l_k" href="../functions/use.html">use</a> <a class="l_w" href="../Locale/Constants.html">Locale::Constants</a><span class="sc">;</span>
87
 
    
88
 
    <span class="i">$script</span>  = <span class="i">code2script</span><span class="s">(</span><span class="q">&#39;ph&#39;</span><span class="s">)</span><span class="sc">;</span>                       <span class="c"># &#39;Phoenician&#39;</span>
 
88
<pre class="verbatim">    <a class="l_k" href="../functions/use.html">use</a> <span class="w">Locale::Script</span><span class="sc">;</span>
 
89
    <a class="l_k" href="../functions/use.html">use</a> <span class="w">Locale::Constants</span><span class="sc">;</span></pre>
 
90
<pre class="verbatim">    <span class="i">$script</span>  = <span class="i">code2script</span><span class="s">(</span><span class="q">&#39;ph&#39;</span><span class="s">)</span><span class="sc">;</span>                       <span class="c"># &#39;Phoenician&#39;</span>
89
91
    <span class="i">$code</span>    = <span class="i">script2code</span><span class="s">(</span><span class="q">&#39;Tibetan&#39;</span><span class="s">)</span><span class="sc">;</span>                  <span class="c"># &#39;bo&#39;</span>
90
92
    <span class="i">$code3</span>   = <span class="i">script2code</span><span class="s">(</span><span class="q">&#39;Tibetan&#39;</span><span class="cm">,</span>
91
 
                           LOCALE_CODE_ALPHA_3<span class="s">)</span><span class="sc">;</span>        <span class="c"># &#39;bod&#39;</span>
 
93
                           <span class="w">LOCALE_CODE_ALPHA_3</span><span class="s">)</span><span class="sc">;</span>        <span class="c"># &#39;bod&#39;</span>
92
94
    <span class="i">$codeN</span>   = <span class="i">script2code</span><span class="s">(</span><span class="q">&#39;Tibetan&#39;</span><span class="cm">,</span>
93
 
                           LOCALE_CODE_ALPHA_NUMERIC<span class="s">)</span><span class="sc">;</span>  <span class="c"># 330</span>
94
 
    
95
 
    <span class="i">@codes</span>   = <span class="i">all_script_codes</span><span class="s">(</span><span class="s">)</span><span class="sc">;</span>
96
 
    <span class="i">@scripts</span> = <span class="i">all_script_names</span><span class="s">(</span><span class="s">)</span><span class="sc">;</span>
97
 
    </pre>
 
95
                           <span class="w">LOCALE_CODE_ALPHA_NUMERIC</span><span class="s">)</span><span class="sc">;</span>  <span class="c"># 330</span></pre>
 
96
<pre class="verbatim">    <span class="i">@codes</span>   = <span class="i">all_script_codes</span><span class="s">(</span><span class="s">)</span><span class="sc">;</span>
 
97
    <span class="i">@scripts</span> = <span class="i">all_script_names</span><span class="s">(</span><span class="s">)</span><span class="sc">;</span></pre>
98
98
<a name="DESCRIPTION"></a><h1>DESCRIPTION</h1>
99
 
<p>The <code class="inline"><a class="l_w" href="../Locale/Script.html">Locale::Script</a></code> module provides access to the ISO
 
99
<p>The <code class="inline"><span class="w">Locale::Script</span></code>
 
100
 module provides access to the ISO
100
101
codes for identifying scripts, as defined in ISO 15924.
101
102
For example, Egyptian hieroglyphs are denoted by the two-letter
102
103
code 'eg', the three-letter code 'egy', and the numeric code 050.</p>
108
109
<ul>
109
110
<li><a name="*alpha-2*"></a><b><b>alpha-2</b></b>
110
111
<p>Two letter codes, such as 'bo' for Tibetan.
111
 
This code set is identified with the symbol <code class="inline">LOCALE_CODE_ALPHA_2</code>
 
112
This code set is identified with the symbol <code class="inline"><span class="w">LOCALE_CODE_ALPHA_2</span></code>
112
113
.</p>
113
114
</li>
114
115
<li><a name="*alpha-3*"></a><b><b>alpha-3</b></b>
115
116
<p>Three letter codes, such as 'ell' for Greek.
116
 
This code set is identified with the symbol <code class="inline">LOCALE_CODE_ALPHA_3</code>
 
117
This code set is identified with the symbol <code class="inline"><span class="w">LOCALE_CODE_ALPHA_3</span></code>
117
118
.</p>
118
119
</li>
119
120
<li><a name="*numeric*"></a><b><b>numeric</b></b>
120
121
<p>Numeric codes, such as 410 for Hiragana.
121
 
This code set is identified with the symbol <code class="inline">LOCALE_CODE_NUMERIC</code>
 
122
This code set is identified with the symbol <code class="inline"><span class="w">LOCALE_CODE_NUMERIC</span></code>
122
123
.</p>
123
124
</li>
124
125
</ul>
170
171
script code, if such exists.
171
172
If the argument could not be identified as a script name,
172
173
then <code class="inline"><a class="l_k" href="../functions/undef.html">undef</a></code> will be returned:</p>
173
 
<pre class="verbatim">    <span class="i">$code</span> = <span class="i">script2code</span><span class="s">(</span><span class="q">&#39;Gothic&#39;</span><span class="cm">,</span> LOCALE_CODE_ALPHA_3<span class="s">)</span><span class="sc">;</span>
 
174
<pre class="verbatim">    <span class="i">$code</span> = <span class="i">script2code</span><span class="s">(</span><span class="q">&#39;Gothic&#39;</span><span class="cm">,</span> <span class="w">LOCALE_CODE_ALPHA_3</span><span class="s">)</span><span class="sc">;</span>
174
175
    <span class="c"># $code will now be &#39;gth&#39;</span></pre>
175
176
<p>The case of the script name is not important.
176
177
See the section <a href="#KNOWN-BUGS-AND-LIMITATIONS">"KNOWN BUGS AND LIMITATIONS"</a> below.</p>
179
180
<p>This function takes a script code from one code set,
180
181
and returns the corresponding code from another code set.</p>
181
182
<pre class="verbatim">    <span class="i">$alpha2</span> = <span class="i">script_code2code</span><span class="s">(</span><span class="q">&#39;jwi&#39;</span><span class="cm">,</span>
182
 
                 LOCALE_CODE_ALPHA_3 <span class="cm">=&gt;</span> LOCALE_CODE_ALPHA_2<span class="s">)</span><span class="sc">;</span>
 
183
                 <span class="w">LOCALE_CODE_ALPHA_3</span> <span class="cm">=&gt;</span> <span class="w">LOCALE_CODE_ALPHA_2</span><span class="s">)</span><span class="sc">;</span>
183
184
    <span class="c"># $alpha2 will now be &#39;jw&#39; (Javanese)</span></pre>
184
185
<p>If the code passed is not a valid script code in
185
186
the first code set, or if there isn't a code for the
191
192
<p>There are two function which can be used to obtain a list of all codes,
192
193
or all script names:</p>
193
194
<ul>
194
 
<li><a name="'all_script_codes-(-%5b-CODESET-%5d-)'"></a><b><code class="inline">all_script_codes <span class="s">(</span> <span class="s">[</span> CODESET <span class="s">]</span> <span class="s">)</span></code>
 
195
<li><a name="'all_script_codes-(-%5b-CODESET-%5d-)'"></a><b><code class="inline"><span class="w">all_script_codes</span> <span class="s">(</span> <span class="s">[</span> <span class="w">CODESET</span> <span class="s">]</span> <span class="s">)</span></code>
195
196
</b>
196
197
<p>Returns a list of all two-letter script codes.
197
198
The codes are guaranteed to be all lower-case,
198
199
and not in any particular order.</p>
199
200
</li>
200
 
<li><a name="'all_script_names-(-%5b-CODESET-%5d-)'"></a><b><code class="inline">all_script_names <span class="s">(</span> <span class="s">[</span> CODESET <span class="s">]</span> <span class="s">)</span></code>
 
201
<li><a name="'all_script_names-(-%5b-CODESET-%5d-)'"></a><b><code class="inline"><span class="w">all_script_names</span> <span class="s">(</span> <span class="s">[</span> <span class="w">CODESET</span> <span class="s">]</span> <span class="s">)</span></code>
201
202
</b>
202
203
<p>Returns a list of all script names for which there is a corresponding
203
204
script code in the specified code set.
209
210
 function.
210
211
The user is prompted for a script code, and then told the corresponding
211
212
script name:</p>
212
 
<pre class="verbatim">    <span class="i">$|</span> = <span class="n">1</span><span class="sc">;</span>   <span class="c"># turn off buffering</span>
213
 
    
214
 
    <a class="l_k" href="../functions/print.html">print</a> <span class="q">&quot;Enter script code: &quot;</span><span class="sc">;</span>
 
213
<pre class="verbatim">    <span class="i">$|</span> = <span class="n">1</span><span class="sc">;</span>   <span class="c"># turn off buffering</span></pre>
 
214
<pre class="verbatim">    <a class="l_k" href="../functions/print.html">print</a> <span class="q">&quot;Enter script code: &quot;</span><span class="sc">;</span>
215
215
    <a class="l_k" href="../functions/chop.html">chop</a><span class="s">(</span><span class="i">$code</span> = <span class="q">&lt;STDIN&gt;</span><span class="s">)</span><span class="sc">;</span>
216
 
    <span class="i">$script</span> = <span class="i">code2script</span><span class="s">(</span><span class="i">$code</span><span class="cm">,</span> LOCALE_CODE_ALPHA_2<span class="s">)</span><span class="sc">;</span>
 
216
    <span class="i">$script</span> = <span class="i">code2script</span><span class="s">(</span><span class="i">$code</span><span class="cm">,</span> <span class="w">LOCALE_CODE_ALPHA_2</span><span class="s">)</span><span class="sc">;</span>
217
217
    if <span class="s">(</span><a class="l_k" href="../functions/defined.html">defined</a> <span class="i">$script</span><span class="s">)</span>
218
218
    <span class="s">{</span>
219
219
        <a class="l_k" href="../functions/print.html">print</a> <span class="q">&quot;$code = $script\n&quot;</span><span class="sc">;</span>
282
282
          <!--<select name="r"><option value="1" selected>Go to top result<option value="0">Show results list</select>-->
283
283
        </form>
284
284
      </p>
 
285
      <script language="JavaScript" type="text/javascript" src="/perl-version.js"></script>
285
286
      <h2>Labels:</h2>
286
287
      <p>
287
288
        <a href="#" onClick="addLabel('Locale::Script','Locale/Script.html')">Add this page</a>