YAMASHINA Hio
hio****@users*****
2006年 10月 26日 (木) 00:41:12 JST
Index: docs/modules/Test-Base-0.52/lib/Test/Base/Filter.pod diff -u /dev/null docs/modules/Test-Base-0.52/lib/Test/Base/Filter.pod:1.1 --- /dev/null Thu Oct 26 00:41:12 2006 +++ docs/modules/Test-Base-0.52/lib/Test/Base/Filter.pod Thu Oct 26 00:41:12 2006 @@ -0,0 +1,452 @@ +=encoding utf8 + +=head1 åå + +Test::Base::Filter - Test::Base ã®ããã©ã«ãã®ãã£ã«ã¿ã¯ã©ã¹ + +=head1 æ¦è¦ + + package MyTestSuite; + use Test::Base -Base; + + ... reusable testing code ... + + package MyTestSuite::Filter; + use Test::Base::Filter -Base; + + sub my_filter1 { + ... + } + +=head1 説æ + +Filters are the key to writing effective data driven tests with Test::Base. +Test::Base::Filter is a class containing a large default set of generic +filters. You can easily subclass it to add/override functionality. + +ãã£ã«ã¿ã¯ Test::Base ã§å¹æçãªãã¼ã¿é§åãã¹ããè¨è¿°ãã +è¦ã®è¦ç´ ã§ã. Test::Base::Filter ã«ã¯æ±ç¨çãªãã£ã«ã¿ã® +æ°å¤ãã®ããã©ã«ãã®éåãå«ã¾ãã¦ãã¾ã. æ©è½ã追å , ä¸æ¸ãããããã« +ãµãã¯ã©ã¹åãããã¨ãç°¡åã«ã§ãã¾ã. + +=head1 ãã£ã«ã¿ + +This is a list of the default stock filters (in alphabetic order): + +ããã©ã«ãã§å ¥ã£ã¦ãããã£ã«ã¿ã¯ä»¥ä¸ã®éãã§ã(ã¢ã«ãã¡ãããé ): + +=head2 append + +list => list + + +Append a string to each element of a list. + +ãªã¹ãã®åè¦ç´ ã«æååã追å ãã¾ã. + + --- numbers lines chomp append=-#\n join + one + two + three + +=head2 array + +list => scalar + + +Turn a list of values into an anonymous array reference. + +å¤ã®ãªã¹ããç¡åé åã®ãªãã¡ã¬ã³ã¹ã«å¤æãã¾ã. + +=head2 base64_decode + +scalar => scalar + + +Decode base64 data. Useful for binary tests. + +base64 ãã¼ã¿ããã³ã¼ããã¾ã. ãã¤ããªã®ãã¹ãã«ä¾¿å©ã§ã. + +=head2 base64_encode + +scalar => scalar + + +Encode base64 data. Useful for binary tests. + +ãã¼ã¿ã base64 ã¨ã³ã³ã¼ããã¾ã. ãã¤ããªã®ãã¹ãã«ä¾¿å©ã§ã. + +=head2 chomp + +list => list + + +Remove the final newline from each string value in a list. + +ãªã¹ãã®åæååå¤ããæå¾ã®æ¹è¡æåãåãé¤ãã¾ã. + +=head2 chop + +list => list + + +Remove the final char from each string value in a list. + +ãªã¹ãã®åæååå¤ããæå¾ã®æåãåãé¤ãã¾ã. + +=head2 dumper + +scalar => list + + +Take a data structure (presumably from another filter like eval) and use +Data::Dumper to dump it in a canonical fashion. + +ãã¼ã¿æ§é (ããããevalçä»ã®ãã£ã«ã¿ã§çæããããã®)ãåãåã£ã¦ +Data::Dumper ã使ã£ã¦æ£è¦å½¢å¼ã«ãã³ããã¾ã. + +=head2 escape + +scalar => scalar + + +Unescape all backslash escaped chars. + +ããã¯ã¹ã©ãã·ã¥ã¨ã¹ã±ã¼ããããå ¨ã¦ã®æåãã¢ã³ã¨ã¹ã±ã¼ããã¾ã. + +=head2 eval + +scalar => list + + +Run Perl's C<eval> command against the data and use the returned value +as the data. + +ãã¼ã¿ã«å¯¾ã㦠Perl ã® C<eval> ã³ãã³ããå®è¡ã, ãã®å¾©å¸°å¤ã +ãã¼ã¿ã¨ãã¦å©ç¨ãã¾ã. + +=head2 eval_all + +scalar => list + + +Run Perl's C<eval> command against the data and return a list of 4 +values: + +ãã¼ã¿ã«å¯¾ã㦠Perl ã® C<eval> ã³ãã³ããå®è¡ã, ï¼ã¤ã®å¤ããæã +ãªã¹ããè¿ãã¾ã: + + 1) The return value + 2) The error in $@ + 3) Captured STDOUT + 4) Captured STDERR + 1) å¾©å¸°å¤ + 2) $@ ã®ã¨ã©ã¼å 容 + 3) STDOUT ã®å 容 + 4) STDERR ã®å 容 + +=head2 eval_stderr + +scalar => scalar + + +Run Perl's C<eval> command against the data and return the +captured STDERR. + +ãã¼ã¿ã«å¯¾ã㦠Perl ã® C<eval> ã³ãã³ããå®è¡ã, STDERR ãã +å¾ãããå 容ãè¿ãã¾ã. + +=head2 eval_stdout + +scalar => scalar + + +Run Perl's C<eval> command against the data and return the +captured STDOUT. + +ãã¼ã¿ã«å¯¾ã㦠Perl ã® C<eval> ã³ãã³ããå®è¡ã, STDOUT ãã +å¾ãããå 容ãè¿ãã¾ã. + +=head2 exec_perl_stdout + +list => scalar + + +Input Perl code is written to a temp file and run. STDOUT is captured and +returned. + +å ¥åããã Perl ã³ã¼ãããã³ãã©ãªãã¡ã¤ã«ã«æ¸ãåºãã¦å®è¡ãã¾ã. +STDOUT ãèªã¿è¾¼ãã§è¿ãã¾ã. + +=head2 flatten + +scalar => list + + +Takes a hash or array ref and flattens it to a list. +=head2 get_url + +ããã·ã¥åã¯é åã®ãªãã¡ã¬ã³ã¹ãåãåã£ã¦, +å¹³ãããªã¹ãã«ãã¾ã. + +scalar => scalar + + +The text is chomped and considered to be a url. Then LWP::Simple::get is +used to fetch the contents of the url. + +ããã¹ã㯠chomp ãã, url ã¨ãã¦æ±ããã¾ã. ããã¦ãã® url ã®å 容ã +LWP::Simple::get ã使ã£ã¦åå¾ãã¾ã. + +=head2 hash + +list => scalar + + +Turn a list of key/value pairs into an anonymous hash reference. + +ãã¼/å¤ãã¢ãç¡åããã·ã¥ã®ãªãã¡ã¬ã³ã¹ã«å¤æãã¾ã. + +=head2 head[=number] + +list => list + + +Takes a list and returns a number of the elements from the front of it. The +default number is one. + +ãªã¹ããåãåã£ã¦ãã®åãã®ä½åãã®è¦ç´ ãè¿ãã¾ã. +çç¥æã¯ï¼ã¤ã§ã. + +=head2 join + +list => scalar + + +Join a list of strings into a scalar. + +æååã®ãªã¹ããã¹ã«ã©ã¼ã« join ãã¾ã. + +=head2 Join + +Join the list of strings inside a list of array refs and return the +strings in place of the array refs. + +é åã®ãªã¹ãã®ä¸ã«ããæååã®ãªã¹ãã join ãã¦, é åãªãã¡ã¬ã³ã¹ã® +代ããã«æååãè¿ãã¾ã. + +=head2 lines + +scalar => list + + +Break the data into an anonymous array of lines. Each line (except +possibly the last one if the C<chomp> filter came first) will have a +newline at the end. + +ãã¼ã¿ãè¡ã®ç¡åé åã«ç ãã¾ã. åè¡ã¯çµç«¯ã«æ¹è¡æåãæã¡ã¾ã +(C<chomp> ãã£ã«ã¿ãå ã«é©ç¨ããã¦ããå ´åã«ã¯, +æå¾ã®è¡ã«ã¯ãªãããããã¾ãã). + +=head2 norm + +scalar => scalar + + +Normalize the data. Change non-Unix line endings to Unix line endings. + +ãã¼ã¿ãæ£è¦å(normalize)ãã¾ã. +non-Unix è¡æ«ã, Unix è¡æ«ã«å¤æãã¾ã. + +=head2 prepend=string + +list => list + + +Prepend a string onto each of a list of strings. + +æååã®ãªã¹ãã®åè¦ç´ ã«æååãåç½®ãã¾ã. + +=head2 read_file + +scalar => scalar + + +Read the file named by the current content and return the file's content. + +ç¾å¨ã®å 容ã§ä¸ããããååã®ãã¡ã¤ã«ãèªã¿è¾¼ãã§, +ãã¡ã¤ã«ã®å 容ãè¿ãã¾ã. + +=head2 regexp[=xism] + +scalar => scalar + + +The C<regexp> filter will turn your data section into a regular +expression object. You can pass in extra flags after an equals sign. + +C<regexp> ãã£ã«ã¿ã¯ãã¼ã¿ã»ã¯ã·ã§ã³ãæ£è¦è¡¨ç¾ãªãã¸ã§ã¯ãã« +å¤æãã¾ã. çå·è¨å·ã®å¾ã§ãã©ã°ãæå®ã§ãã¾ã. + +If the text contains more than one line and no flags are specified, then +the 'xism' flags are assumed. + +ããã¹ããï¼è¡ä»¥ä¸ãã£ã¦ãã©ã°ãæå®ãããªãã£ãæã«ã¯, +'xism' ãã©ã°ãé©ç¨ããã¾ã. + +=head2 reverse + +list => list + + +Reverse the elements of a list. + +ãªã¹ãã®è¦ç´ ãå転ãã¾ã. + +=head2 Reverse + +list => list + + +Reverse the list of strings inside a list of array refs. + +é åãªãã¡ã¬ã³ã¹ã®ãªã¹ãã®ä¸ã®æååã®ãªã¹ããå転ãã¾ã. + +=head2 slice=x[,y] + +list => list + + +Returns the element number x through element number y of a list. + +ãªã¹ãã® x çªç®ãã y çªç®ã®è¦ç´ ãè¿ãã¾ã. + +=head2 sort + +list => list + + +Sorts the elements of a list in character sort order. + +ãªã¹ãã®è¦ç´ ãæååé ã§ã½ã¼ããã¾ã. + +=head2 Sort + +list => list + + +Sort the list of strings inside a list of array refs. + +é åãªãã¡ã¬ã³ã¹ã®ãªã¹ãã®ä¸ã®æååã®ãªã¹ããã½ã¼ããã¾ã. + +=head2 split[=string|pattern] + +scalar => list + + +Split a string in into a list. Takes a optional string or regexp as a +parameter. Defaults to /\s+/. Same as Perl C<split>. + +æååããªã¹ãã«åå²(split)ãã¾ã. ä»»æã§æååè¥ãã㯠+æ£è¦è¡¨ç¾ããã©ã¡ã¼ã¿ã¨ãã¦åãåãã¾ã. ããã©ã«ã㯠+/\s+/ ã§ã. Perl ã® C<split> ã¨åæ§ã§ã. + +=head2 Split[=string|pattern] + +list => list + + +Split each of a list of strings and turn them into array refs. + +æååã®ãªã¹ãã®åè¦ç´ ã split ãã¦, é åã®ãªãã¡ã¬ã³ã¹ã«ãã¾ã. + +=head2 strict + +scalar => scalar + + +Prepend the string: + +ãããã¯ã®ããã¹ãã« + + use strict; + use warnings; + +to the block's text. + +ãåç½®ãã¾ã. + +=head2 tail[=number] + +list => list + + +Return a number of elements from the end of a list. The default +number is one. + +ãªã¹ãã®æ«å°¾ããæå®æ°ã®è¦ç´ ãè¿ãã¾ã. +çç¥æã¯ï¼ã¤ã§ã. + +=head2 trim + +list => list + + +Remove extra blank lines from the beginning and end of the data. This +allows you to visually separate your test data with blank lines. + +ãã¼ã¿ã®éå§åã³çµäºä¸¡å´ããä½è¨ãªç©ºè¡ãåãé¤ãã¾ã. +ãããå©ç¨ãããã¨ã§ãã¹ããã¼ã¿ã«ç©ºè¡ã使ã£ãè¦è¦ç㪠+ã»ãã¬ã¼ã¿ãæ±ããã¨ãã§ãã¾ã. + +=head2 unchomp + +list => list + + +Add a newline to each string value in a list. + +ãªã¹ãã®åæååå¤ã«æ¹è¡æåã追å ãã¾ã. + +=head2 write_file[=filename] + +scalar => scalar + + +Write the content of the section to the named file. Return the filename. + +ã»ã¯ã·ã§ã³ã®å 容ãååä»ããã¡ã¤ã«ã«æ¸ãåºãã¾ã. +ãã¡ã¤ã«åãè¿ãã¾ã. + +=head2 yaml + +scalar => list + + +Apply the YAML::Load function to the data block and use the resultant +structure. Requires YAML.pm. + +ãã¼ã¿ãããã¯ã« YAML::Load é¢æ°ãé©ç¨ã, å¾ãããæ§é ã +å©ç¨ãã¾ã. YAML.pm ã require ãã¾ã. + +=head1 èè + +Ingy dE<ouml>t Net <ingy****@cpan*****> + + +=head1 èä½æ¨© + +Copyright (c) 2006. Ingy dE<ouml>t Net. All rights reserved. +Copyright (c) 2005. Brian Ingerson. All rights reserved. + + +This program is free software; you can redistribute it and/or modify it +under the same terms as Perl itself. + +ãã®ããã°ã©ã ã¯ããªã¼ã½ããã¦ã§ã¢ã§ããããªã㯠Perl ã¨åã +ã©ã¤ã»ã³ã¹ã® å ã§åé å¸åã³å¤æ´ãè¡ããã¨ãåºæ¥ã¾ã. + +See http://www.perl.com/perl/misc/Artistic.html + +åè http://www.perl.com/perl/misc/Artistic.html +