Rose :: HTML :: Form.

ROSE :: HTML :: FORMÀº HTML ¾ç½Ä ±âº» Ŭ·¡½ºÀÔ´Ï´Ù.
Áö±Ý ´Ù¿î·Îµå

Rose :: HTML :: Form. ¼øÀ§ ¹× ¿ä¾à

±¤°í

  • Rating:
  • ƯÇã:
  • Perl Artistic License
  • °¡°Ý:
  • FREE
  • °Ô½ÃÀÚ À̸§:
  • John C. Siracusa
  • °Ô½ÃÀÚ À¥»çÀÌÆ®:
  • http://search.cpan.org/~jsiracusa/

Rose :: HTML :: Form. ű×


Rose :: HTML :: Form. ¼³¸í

Rose :: HTML :: FormÀº HTML ¾ç½Ä ±âº» Ŭ·¡½ºÀÔ´Ï´Ù. Rose :: HTML :: FormÀº HTML ¾ç½Ä ±âº» Ŭ·¡½ºÀÔ´Ï´Ù. Synopsis ÆÐÅ°Áö PersonForm; Rose :: HTML :: Form; @isa = qw (Rose :: html :: form); »ç¶÷À» »ç¿ëÇϽʽÿÀ; sub build_form {my ($ self) = À̵¿; $ self-> add_fields (name => {type => 'text', size => 25, Çʼö => 1}, À̸ÞÀÏ => {type => 'size => 50, Çʼö => 1}, ÀüÈ­ => {type => 'ÀüÈ­'},); } ÇÏÀ§ À¯È¿¼º °Ë»ç {My ($ self) = Shift; # ±âº» Ŭ·¡½º´Â °³º° Çʵ带 È®ÀÎÇÕ´Ï´Ù. # ¸ðµç Çʼö Çʵ尡 ä¿öÁ® ÀÖÀ½À» È®ÀÎÇÏ°í # À̸ÞÀÏ ÁÖ¼Ò¿Í ÀüÈ­ ¹øÈ£°¡ ¿Ã¹Ù¸£°Ô Çü½ÄÀÌ ÁöÁ¤µË´Ï´Ù. ³» $ OK = $ self-> super :: validate (@_); ($ OK)ÇÏÁö ¾Ê´Â ÇÑ $ OK¸¦ ¹ÝȯÇÕ´Ï´Ù. # Inter-Field ValidationÀÌ ($ self-> Çʵå ( 'À̸§') -> internal_value ne 'John Doe'$ self-> field ( 'ÀüÈ­') -> internal_value = ~ / ^ 555 /) {$ self -> ¿À·ù ( 'John Doe ¸¸ 555 °³ÀÇ ÀüÈ­ ¹øÈ£°¡ÀÖÀ» ¼ö ÀÖ½À´Ï´Ù.); ¹Ýȯ 0; } ¸®ÅÏ 1; } sub init_with_person #Àº ±âº» Ŭ·¡½º ¸Þ¼Òµå¿¡ ´ëÇÑ Ä£ÀýÇÑ À̸§À» Á¦°øÇÕ´Ï´Ù. {My ($ self, $ person) = @_; $ self-> init_with_object ($ person); } sub person_from_form {my ($ self) = shift; # Base Class ¸Þ¼Òµå´Â ´ëºÎºÐÀÇ ÀÛ¾÷ ³» $ Person = $ self-> object_from_form (class => '»ç¶÷')À» ¼öÇàÇÕ´Ï´Ù. # ÀÌÁ¦ ºÒ¸íÀÇ ¼¼ºÎ »çÇ×À» ±âÀÔÇϽʽÿÀ ... # ¿¹¸¦ µé¾î, ÀÏ¹Ý ÀüÈ­ $ Person-> Alt_Phone ($ self-> Çʵå ( 'ÀüÈ­') -> internal_value)¿Í µ¿ÀÏÇÏ°Ô Alt PhoneÀ» ¼³Á¤ÇϽʽÿÀ. $ PersonÀ» µ¹·ÁÁֽʽÿÀ. } ... # # $ Form = PersonForm-> »õ·Î ¸¸µé±â # $ Form = PersonForm-> »õ·Î¿î »ç¿ë¹ý if (...) {# hash ref¿¡¼­ Äõ¸® ¸Å°³ º¯¼ö¸¦ °¡Á®¿À°í MyWebserver-> get_query_params () ¾ç½Ä¿¡ Àü´ÞÇϽʽÿÀ. $ ¾ç½Ä -> params ($ params); # ... ¶Ç´Â CGI °³Ã¼ # $ Form-> params_from_cgi ($ CGI)¿¡¼­ ¾ç½Ä ¸Å°³ º¯¼ö¸¦ ÃʱâÈ­ÇÕ´Ï´Ù. # $ CGI "ISA"CGI # ... ¶Ç´Â Apache ¿äû ¿ÀºêÁ§Æ® # (mod_perl 1 ¹× 2 ¸ðµÎ Áö¿øµÊ) # $ form-> params_from_apache ($ r); # params $ form-> init_fields ()¿¡ µû¶ó Çʵ带 ÃʱâÈ­ÇÕ´Ï´Ù. ($ Çü»ó -> À¯È¿¼º °Ë»ç) {¹Ýȯ error_page (¿À·ù => $ Çü»ó -> ¿À·ù)¸¦ Á¦¿ÜÇÏ°í; } $ Person = $ Form-> Person_From_Form; # $ PersonÀº »ç¶÷ °´Ã¼ do_something_with ($ person)ÀÔ´Ï´Ù. ...} ´Ù¸¥ {$ »ç¶÷ = ...; # Person °³Ã¼¸¦ ¾ò°Å³ª ¸¸µé ¼ö ÀÖ½À´Ï´Ù. # °³ÀÎ °´Ã¼ $ Form-> Init_With_Person ($ Person)À¸·Î ¾ç½ÄÀ» ÃʱâÈ­ÇÕ´Ï´Ù. # ÃʱâÈ­ µÈ ¾ç½Ä °´Ã¼¸¦ Template Display_Page (Æû => $ ¾ç½Ä)·Î Àü´ÞÇÕ´Ï´Ù. } ... ·ÎÁî : HTML :: ¾ç½ÄÀº HTML ű×ÀÇ ´ÜÁö °´Ã¼ Ç¥Çö ÀÌ»óÀÔ´Ï´Ù. ÇüÅÂÀÇ ´ë±Ô¸ð À¥ ¾ÖÇø®ÄÉÀ̼ÇÀ» ±¸Ãà ÇÒ ¶§À¸·Î ÃʱâÈ­ÇÏ°í ¹Ýȯ ÇÒ ¼ö ÀÖ½À´Ï´Ù »ç¿ëÀÚ ÁöÁ¤ ¾ç½Ä Ŭ·¡½ºÀÇ ±âº» Ŭ·¡½º·Î ÀÇ¹Ì "ºÎÀÚ"µîÀÇ °³Ã¼¿Í °°Àº °ª, ¶Ç´Â ¾ç½Ä Ŭ·¡½ºÀÇ Àç»ç¿ë °¡´ÉÇÑ ¶óÀ̺귯¸®¸¦ objects.BuildingÀÇ Ä÷º¼ÇÀº ¸Å¿ì À¯¿ëÇÕ´Ï´Ù ±× ¸¹Àº ´Ù¸¥ Àå¼Ò¿¡ ³ªÅ¸³¯ ¼ö ÀÖ½À´Ï´Ù. ºñ½ÁÇÑ ÇüÅÂÀÇ °øÅë ¼­ºê Ŭ·¡½º¿¡¼­ »ó¼Ó ÇÒ ¼ö ÀÖÀ¸¸ç, ¾ç½Ä¿¡¼­ nested.This Ŭ·¡½º¸¦ »ó¼Ó ÇÒ ¼ö ÀÖÀ¸¸ç, ·ÎÁî :: HTML :: °³Ã¼ÀÇ ±ÔÄ¢À» µû¸¨´Ï´Ù. ¿À¹ö¶óÀ̵å (override)ÇÏÁö ¾Ê´Â »ó¼Ó ¹æ¹ýÀº ¿©±â¿¡ µÎ ¹ø°·Î ±â·ÏµÇÁö ¾Ê½À´Ï´Ù. ÀÚ¼¼ÇÑ ³»¿ëÀº ·ÎÁî :: HTML :: °³Ã¼ ¼³¸í¼­¸¦ ÂüÁ¶ÇϽʽÿÀ. ¿ä±¸ »çÇ× : ¡¤ Perl.


Rose :: HTML :: Form. °ü·Ã ¼ÒÇÁÆ®¿þ¾î