| Ŭ·¡½º :: ȸ¿ø :: Çؽà Ŭ·¡½º :: ȸ¿ø :: Çؽô ¸ðµâ °³¹ßÀ»º¸´Ù ½±°ÔÇϱâÀ§ÇÑ Perl ¸ðµâÀÔ´Ï´Ù. |
Áö±Ý ´Ù¿î·Îµå |
Ŭ·¡½º :: ȸ¿ø :: Çؽà ¼øÀ§ ¹× ¿ä¾à
- ƯÇã:
- Perl Artistic License
- °Ô½ÃÀÚ À̸§:
- Torsten Fortsch
- °Ô½ÃÀÚ À¥»çÀÌÆ®:
- http://search.cpan.org/~cmungall/
Ŭ·¡½º :: ȸ¿ø :: Çؽà ű×
Ŭ·¡½º :: ȸ¿ø :: Çؽà ¼³¸í
Ŭ·¡½º :: ȸ¿ø :: Çؽô ¸ðµâ °³¹ßÀ»º¸´Ù ½±°Ô ¸¸µå´Â Perl ¸ðµâÀÔ´Ï´Ù. Ŭ·¡½º :: ȸ¿ø :: Çؽô ¸ðµâ °³¹ßÀ» ´õ ½±°Ô ¸¸µå´Â Perl ¸ðµâÀÔ´Ï´Ù .Synopsis ÆÐÅ°Áö myModule; Ŭ·¡½º :: ¸â¹ö :: Çؽà QW / MEMBER_A ¸â¹ö _B -CLASS_MEMBERS /; ¶Ç´Â ÆÐÅ°Áö mymodule; Ŭ·¡½º :: ¸â¹ö :: GLOB QW / MEMBER_A ¸â¹ö _B -CLASS_MEMBERS /; ¶Ç´Â ÆÐÅ°Áö mymodule; Ŭ·¡½º :: ¸â¹ö qw / member_a member_b -class_members /; ¶Ç´Â ÆÐÅ°Áö mymodule; Ŭ·¡½º :: ¸â¹ö :: µ¿Àû qw / member_a member_b -class_members /; Perl Ŭ·¡½º ÀνºÅϽº´Â ´ëºÎºÐ Ãູ¹ÞÀº Çؽà ¶Ç´Â ±Û·Îºê¸¦ "$ self-> {membername}"¶Ç´Â "$ {* $ self} {membernameÀ¸·Î ÀúÀåÇÕ´Ï´Ù. } "°¢°¢. ÀÌ·¯ÇÑ ¸ðµâÀ» ±â¹ÝÀ¸·Î ÆÄ»ý µÈ Ŭ·¡½º¸¦ °³¹ßÇϱ⠽ÃÀÛÇÒ ¶§ ¸Å¿ì ¿À·ù°¡ ¹ß»ýÇϱ⠽±½À´Ï´Ù. ÆÄ»ý Ŭ·¡½ºÀÇ °³¹ßÀÚ´Â À̸§ Ãæµ¹À» ÇÇÇϱâ À§ÇØ ±âº» Ŭ·¡½ºÀÇ ±¸¼º¿ø º¯¼ö¸¦º¸¾Æ¾ßÇÕ´Ï´Ù. "class :: ¸â¹ö :: xxx"¸¦ ÇÇÇϱâ À§ÇØ ÆÐÅ°Áö À̸§ ¾Õ¿¡ ÆÐÅ°Áö À̸§ ¾Õ¿¡ ÆÐÅ°Áö À̸§ ¾Õ¿¡¼ ¸â¹ö º¯¼ö¸¦ ÀúÀåÇÕ´Ï´Ù. ÆÐÅ°Áö My :: New :: Module; Ŭ·¡½º :: ¸â¹ö :: Çؽà QW / MEMBER_A ¸â¹ö /; "member_a"¸¦ "$ self-> my :: new :: module :: member_a '}·Î ÀúÀåÇÕ´Ï´Ù. ÀÌ·¯ÇÑ ¸â¹öµé¿¡ ´ëÇÑ ¾×¼¼½º¸¦ À§ÇØ ½±°Ô ¾×¼¼½º ÇÔ¼ö¸¦ È£ÃâÀÚ ³×ÀÓ ½ºÆäÀ̽º·Î ³»º¸³¾ ¼ö ÀÖ½À´Ï´Ù. "member_a"¿¡ ¾×¼¼½ºÇÏ·Á¸é ´Ü¼øÈ÷ È£ÃâÇÕ´Ï´Ù. $ self-> member_a; # Àб⠾׼¼½º $ self-> member_a ($ new_value); # ¾²±â $ self-> member_a = $ new_value; # ¾²±â ¾×¼¼½º (lvalue·Î »ç¿ëµÊ) "Ŭ·¡½º :: ¸â¹ö :: ÇؽÃ"¹× "Ŭ·¡½º :: ȸ¿ø :: GLOB"¹× "class :: member :: glob"°¡ °´Ã¼°¡ Çؽà ¶Ç´Â Glob ÂüÁ¶ ÀÎ °æ¿ì »ç¿ëµË´Ï´Ù. ±×·¯³ª ¶§·Î´Â ÀνºÅϽº°¡ GLOBS ¶Ç´Â ÇؽÃÀÎÁö ¿©ºÎ¸¦ ¾ËÁö ¸øÇÕ´Ï´Ù (±âº» Ŭ·¡½º°¡ º¯°æ µÉ °¡´É¼ºÀÌÀÖ´Â ÆÄ»ý Ŭ·¡½º °³¹ßÀ» °í·ÁÇϽʽÿÀ.). ÀÌ °æ¿ì "Class :: ¸â¹ö"¸¦ »ç¿ëÇÏ°í ¸Þ¼Òµå´Â ÄÄÆÄÀÏ ½Ã°£¿¡ Á¤ÀÇµÇ¾î °¢ À¯ÇüÀÇ °´Ã¼, Globs ¹× Çؽø¦ ó¸®ÇÕ´Ï´Ù. ±×·¯³ª ¸Þ¼µå¿¡ ´ëÇÑ Ã¹ ¹ø° ¾×¼¼½º´Â ½ÇÁ¦ °´Ã¼ À¯Çü¿¡ µû¶óÀ̸¦ ÀçÁ¤ÀÇÇÕ´Ï´Ù. µû¶ó¼ ù ¹ø° ¾×¼¼½º´Â ¾à°£ ´õ ¿À·¡ Áö¼ÓµÇÁö¸¸ ¸ðµç ÈÄ¼Ó È£ÃâÀº "class :: member :: glob"¶Ç´Â "class :: member :: hash"¿Í µ¿ÀÏÇÑ ¼Óµµ·Î ½ÇÇàµË´Ï´Ù. "Ŭ·¡½º :: ȸ¿ø :: µ¿Àû"Àº °´Ã¼°¡ GLOB ¹× Çؽð¡ µ¿½Ã¿¡ÀÖÀ» ¼öÀÖ´Â °æ¿ì »ç¿ëµË´Ï´Ù. ½ÇÁ¦ À¯ÇüÀº °¢ ¾×¼¼½º¿¡¼ °áÁ¤µÇ¸ç ÀûÀýÇÑ Á¶Ä¡°¡ ÃëÇØÁý´Ï´Ù. ȸ¿ø À̸§ ¿Ü¿¡µµ (Áö±Ý±îÁö) ÁÖ¾îÁú ¼öÀÖ´Â ¿É¼ÇÀÌ Çϳª ÀÖ½À´Ï´Ù : "-class_members". "import ()"ÇÔ¼ö´Â Á¤ÀÇÇÑ ¸ðµç ¸Þ¼ÒµåÀÇ À̸§ÀÌ µé¾îÀִ ȣÃâÀÚÀÇ ³×ÀÓ ½ºÆäÀ̽º¿¡ @class_members¶ó´Â ¹è¿À» ¸¸µì´Ï´Ù. µû¶ó¼ °¢ À̸§ÀÌ Å¬·¡½º ¸â¹ö¿¡ ÇØ´çÇÏ´Â À̸§ÀÇ ¸Å°³ º¯¼ö¸¦ ±â´ëÇÏ´Â ÄÁ½ºÆ®¸¯ ÀÎÀÚ¸¦ ¸¸µé ¼ö ÀÖ½À´Ï´Ù. Ŭ·¡½º :: ¸â¹ö qw / member_a member_b -class_members /; @class_members; Sub New {My $ Parent = Shift; ³» $ class = ref ($ parement) || $ ºÎ¸ð; ³» $ i = Ãູ {} => $ class; ³» % o = @ _; if (ref ($ parem)) {$ m (@class_members) {$ i -> $ m = $ »óÀ§ -> $ m »óÀ§ À§·Î }} #Àº À̸§ ÁöÁ¤µÈ ¸Å°³ º¯¼ö°¡ $ m (@Class_Members) {$ i -> $ m = $ o {$ m} {$ m} ($ o {$ m} Á¸ÀçÇÕ´Ï´Ù); } $ i¸¦ µ¹·ÁÁֽʽÿÀ. } ¿ä±¸ »çÇ× : ¡¤ Perl.
Ŭ·¡½º :: ȸ¿ø :: Çؽà °ü·Ã ¼ÒÇÁÆ®¿þ¾î