argra****@users*****
argra****@users*****
2012年 11月 29日 (木) 21:41:32 JST
Index: docs/modules/Sort-Fields-0.90/Fields.pod diff -u docs/modules/Sort-Fields-0.90/Fields.pod:1.2 docs/modules/Sort-Fields-0.90/Fields.pod:1.3 --- docs/modules/Sort-Fields-0.90/Fields.pod:1.2 Thu Jan 27 22:15:07 2011 +++ docs/modules/Sort-Fields-0.90/Fields.pod Thu Nov 29 21:41:32 2012 @@ -2,14 +2,16 @@ =encoding utf8 =head1 NAME -åå + +=begin original Sort::Fields - Sort lines containing delimited fields +=end original + Sort::Fields - åºåããããã£ã¼ã«ããæã¤è¡ã®ã½ã¼ã =head1 SYNOPSIS -æ¦è¦ use Sort::Fields; @sorted = fieldsort [3, '2n'], @lines; @@ -19,35 +21,48 @@ @sorted = $sort_3_2n->(@lines); =head1 DESCRIPTION -説æ + +=begin original Sort::Fields provides a general purpose technique for efficiently sorting lists of lines that contain data separated into fields. +=end original + Sort::Fields ã¯ãã£ã¼ã«ãã«åå²ããããã¼ã¿ãæ ¼ç´ãã¦ããè¡ã®ãªã¹ãã«å¯¾ãã æ±ç¨çã§å¹æçãªã½ã¼ããæä¾ãã¾ã. +=begin original + Sort::Fields automatically imports two subroutines, C<fieldsort> and C<make_fieldsort>, and two variants, C<stable_fieldsort> and C<make_stable_fieldsort>. C<make_fieldsort> generates a sorting subroutine and returns a reference to it. C<fieldsort> is a wrapper for the C<make_fieldsort> subroutine. +=end original + Sort::Fields ã¯ï¼ã¤ã®é¢æ° C<fieldsort> åã³ C<make_fieldsort> ã¨, ãã®å¤å½¢ï¼ã¤ C<stable_fieldsort> åã³ C<make_stable_fieldsort> ã èªåçã«ã¤ã³ãã¼ããã¾ã. C<make_fieldsort> ã¯ã½ã¼ãé¢æ°ãçæã㦠ããã¸ã®ãªãã¡ã¬ã³ã¹ãè¿ãã¾ã. C<fieldsort> 㯠C<make_fieldsort> é¢æ°ã«å¯¾ããã©ããã³ã°ã§ã. +=begin original + The first argument to make_fieldsort is a delimiter string, which is used as a regular expression argument for a C<split> operator. The delimiter string is optional. If it is not supplied, make_fieldsort splits each line using C</\s+/>. +=end original + make_fieldsort ã¸ã®ï¼ã¤ç®ã®å¼æ°ã¯åºåãæååã§ã. ãã㯠C<split> 㫠渡ãæ£è¦è¡¨ç¾ã¨ãã¦ä½¿ããã¾ã. åºåãæååã¯çç¥å¯è½ã§ã. çç¥æã«ã¯ make_fieldsort 㯠C</\s+/> ã使ã£ã¦åè¡ãåå²ãã¾ã. +=begin original + The second argument is an array reference containing one or more field specifiers. The specifiers indicate what fields in the strings will be used to sort the data. The specifier "1" indicates the first @@ -57,6 +72,8 @@ append "n" to the specifier. A specifier of "0" means the entire string ("-0" means the entire string, in reverse order). +=end original + ï¼ã¤ç®ã®å¼æ°ã¯ï¼ã¤ä»¥ä¸ã®ãã£ã¼ã«ãæå®åãå«ãã é åã¸ã®ãªãã¡ã¬ã³ã¹ã§ã. æå®åã§ãã¼ã¿ã®ã½ã¼ãã«ã©ã®ãã£ã¼ã«ãã使ãã®ããæ示ãã¾ã. "1" ãæåã®ãã£ã¼ã«ã, "2" ãï¼ã¤ç®ã®ãã£ã¼ã«ãã§ã. è² ã®æ°ã®æå®, @@ -65,38 +82,55 @@ ãã¾ã. æå®å "0" ã¯æååå ¨ä½ãæå³ãã¾ã. ãã㦠"-0" ã¯æååå ¨ä½ã® éé ãæå³ãã¾ã. +=begin original + The order in which the specifiers appear is the order in which they will be used to sort the data. The primary key is first, the secondary key is second, and so on. +=end original + æå®åã®æå®é ããã¼ã¿ã®ã½ã¼ãã«ä½¿ãé ã«ãªãã¾ã. 主ãã¼ãï¼çªç®, ï¼çªç®ã®ãã¼ãï¼çªç®ã«ãªãã¾ã. +=begin original + C<fieldsort [1, 2], @data> is roughly equivalent to C<make_fieldsort([1, 2])-E<gt>(@data)>. Avoid calling fieldsort repeatedly with the same sort specifiers. If you need to use a particular sort more than once, it is more efficient to call C<make_fieldsort> once and reuse the subroutine it returns. +=end original + C<fieldsort [1, 2], @data> 㯠C<make_fieldsort([1, 2])-E<gt>(@data)> ã¨å¤§ä½ç価ã§ã. fieldsort ãå¼ã¶å ´åã ã¨, åãã½ã¼ãæå®ã§ç¹°ãè¿ã å¼ã³åºãã«æéããããç¨åº¦ã§ã. ç¹å®ã®ã½ã¼ãæ¡ä»¶ã§ç¹°ãè¿ãã½ã¼ãã è¡ãã®ãªã, C<make_fieldsort> ãä¸åº¦ã ãå¼ã³åºã, ããã§å¾ãé¢æ°ã ç¹°ãè¿ã使ãæ¹ãå¹æçã§ã. +=begin original + C<stable_fieldsort> and C<make_stable_fieldsort> are like their "unstable" counterparts, except that the items that compare the same are maintained in their original order. +=end original + C<stable_fieldsort> åã³ C<make_stable_fieldsort> ã¯ããããã® "å®å®ã§ãªã" ãã®ã¨åæ§ã§ã. éãã¯é åºãåä½ã¨ãªãè¦ç´ ã«å¯¾ãã¦ã½ã¼ãã«ä½¿ã£ããã®ã¾ã¾ã® é åºãä¿ãããäºã§ã. =head1 EXAMPLES -ä¾ + +(ä¾) + +=begin original Some sample data (in array C<@data>): +=end original + ãµã³ãã«ãã¼ã¿(C<@data> é åã®ä¸èº«): 123 asd 1.22 asdd @@ -220,30 +254,49 @@ 91 fdgs 3.43 ewet =head1 BUGS -ãã° + +(ãã°) + +=begin original Some rudimentary tests now. +=end original + åºæ¬çãªãã¹ããè¡ã£ã¦ãã¾ã. +=begin original + Perhaps something should be done to catch things like: +=end original + æããè¡ã£ã¦ããã¹ãäºã¯æ¬¡ã®ãããªäºãæã¾ãããã¨ã§ããã: fieldsort '.', [1, 2], @lines; +=begin original + C<'.'> translates to C<split /./> -- probably not what you want. +=end original + C<'.'> 㯠C<split /./> ã¨ãªãã¾ã -- ããã¯æããè¡ãããã£ããã¨ã§ã¯ ãªãã§ããã. +=begin original + Passing blank lines and/or lines containing the wrong kind of data (alphas instead of numbers) can result in copious warning messages under C<-w>. +=end original + 空è¡ãå¦çããã¨ããééã£ã種é¡ã®ãã¼ã¿(æ°å¤ã®ã¤ãããæååã ã£ã)ã¨ãã«ã¯ C<-w> ç°å¢ä¸ã§ã¯ããããã®è¦åã¡ãã»ã¼ã¸ãåºã¦ããã§ããã. +=begin original + If the regexp contains memory parentheses (C<(...)> rather than C<(?:...)>), split will function in "delimiter retention" mode, capturing the contents of the parentheses as well as the stuff between the delimiters. @@ -251,28 +304,32 @@ could also imagine how it could be confusing if encountered unexpectedly. Caveat sortor. +=end original + æ£è¦è¡¨ç¾ãè¨æ¶æ¬å¼§(C<(?:...)> ã§ã¯ãªã C<(...)>)ãå«ãã§ããã®ãªã, split 㯠"åºåãæåä¿æ" ã¢ã¼ãã§æ©è½ãã¾ã. ããã¯æ¬å¼§ã®å 容ã åºåãæåã®éã®è¦ç´ ã¨åãããã«æ½åºãã¾ã. ããã¯ä¾¿å©ã§ããã¨åæã«, æå³ããã«ä½¿ã£ã¦ãã¾ã£ã¦ããã¨ãã«ã¯æ··ä¹±ãæãã¾ã. ååã«æ³¨æãã¦ãã ãã. +=begin original + Not really a bug, but if you are planning to sort a large text file, consider using sort(1). Unless, of course, your operating system doesn't have sort(1). +=end original + ãã°ã§ã¯ããã¾ããã大ããªããã¹ããã¡ã¤ã«ã®ã½ã¼ããè¡ããã¨ãã¦ããã®ãªã, sort(1) ã使ããã¨ãèããæ¹ãè¯ãããããã¾ãã. ãã¡ããããªãã®OSã sort(1) ãæã£ã¦ããã®ãªãã§ãã. =head1 AUTHOR -èè Joseph N. Hall, josep****@5sigm***** =head1 SEE ALSO -é¢é£é ç® perl(1).