| params :: validate. params :: À¯È¿¼º °Ë»ç´Â ¸Þ¼Òµå / ÇÔ¼ö ¸Å°³ º¯¼öÀÇ À¯È¿¼ºÀ» °Ë»çÇÏ´Â Perl ¸ðµâÀÔ´Ï´Ù. |
Áö±Ý ´Ù¿î·Îµå |
params :: validate. ¼øÀ§ ¹× ¿ä¾à
- ƯÇã:
- Perl Artistic License
- °Ô½ÃÀÚ À̸§:
- Dave Rolsky and Ilya Martynov
- °Ô½ÃÀÚ À¥»çÀÌÆ®:
- http://search.cpan.org/~drolsky/
params :: validate. ű×
params :: validate. ¼³¸í
params :: Validate´Â ¸Þ¼Òµå / ÇÔ¼ö ¸Å°³ º¯¼ö¸¦ È®ÀÎÇÏ´Â Perl ¸ðµâÀÔ´Ï´Ù. params :: À¯È¿¼º °ËÁõÀº ¸Þ¼Òµå / ÇÔ¼ö ¸Å°³ º¯¼öÀÇ À¯È¿¼ºÀ» °Ë»çÇÏ´Â Perl ¸ðµâÀÔ´Ï´Ù. Synopsis »ç¿ë params :: validate qw (¸ðµÎ); # named params (Çؽà ¶Ç´Â hashref) ÇÏÀ§ foo {À¯È¿¼º °Ë»ç (@_, {foo => 1, # Çʼö bar => 0, # ¼±ÅÃÀû}); } # Æ÷Áö¼Ç PARMS ¼ºê ¹Ù {# ù ¹ø° µÎ °³°¡ ÇʼöÀ̸ç, ¼¼ ¹ø°´Â ¼±ÅÃÀû VALIDATE_POS (@_, 1, 1, 0)ÀÔ´Ï´Ù. } sub foo2 {Validate (@_, {foo => # {type => arrayref} Çü½Ä ÁöÁ¤, bar => # ÀÎÅÍÆäÀ̽º {CAN => }À» ÁöÁ¤ÇϽʽÿÀ. baz => {type => scalar, # scalar ... # ... ±×°ÍÀº ÀÏ¹Ý Á¤¼öÀÔ´Ï´Ù ... regex => qr / ^ d + $ /, callbacks => {# ... ±×¸®°í 90 ' 90 '=> SUB {SHIFT () <90}}}}); } sub with_defaults {my % p = validate (@_ {foo => 1, # Çʼö # $ p {bar}Àº # $ p {bar}ÀÌ Ç¥½ÃµÇÁö ¾ÊÀ¸¸é 99°¡µË´Ï´Ù. ¸·´ë°¡ ÀÌÁ¦ ¼±Åà »çÇ×ÀÔ´Ï´Ù. bar => {default => 99 }}); } ÇÏÀ§ pos_with_defaults {my @p = validate_pos (@_, 1, {±âº»°ª => 99}); } sub set_options_on_call {my % p = validate_with (params => @_, spec => {foo => {spalar, default => 2}}, normalize_keys => sub {$ _ = s / ^ - //; lc $ _ },); } params :: À¯È¿¼º °Ë»ç ¸ðµâÀ» »ç¿ëÇϸé ÀÓÀÇÀÇ Æ¯À̼º ¼öÁØ¿¡ ¸Þ¼Òµå ¶Ç´Â ÇÔ¼ö È£Ã⠸Ű³ º¯¼ö¸¦ °ËÁõ ÇÒ ¼ö ÀÖ½À´Ï´Ù. °¡Àå °£´ÜÇÑ ¼öÁØ¿¡¼ ÇÊ¿äÇÑ ¸Å°³ º¯¼ö°¡ ÁÖ¾îÁ³°í ÁöÁ¤µÇÁö ¾ÊÀº Ãß°¡ ¸Å°³ º¯¼ö°¡ Àü´ÞµÇÁö ¾Ê¾ÒÀ¸¹Ç·Î ƯÁ¤ À¯ÇüÀÇ ¸Å°³ º¯¼ö°¡ ƯÁ¤ Ŭ·¡½º °èÃþ ±¸Á¶ÀÇ °´Ã¼ÀÓÀ» °áÁ¤ÇÒ ¼ö ÀÖ½À´Ï´Ù. , ƯÁ¤ ¹æ¹ýÀ» ¼ÒÀ¯Çϰųª Àμö¿¡ À¯È¿¼º °Ë»ç ÄݹéÀ» Àû¿ëÇÕ´Ï´Ù. ¡¤ Perl ¿ä±¸ »çÇ× : ¡¤ Perl.
params :: validate. °ü·Ã ¼ÒÇÁÆ®¿þ¾î