| Basset :: ±â°è Basset :: MachineÀº ±â°è¸¦ ÁÖ¿¡ »ç¿ëÇÏ´Â Perl ¸ðµâÀÔ´Ï´Ù. |
Áö±Ý ´Ù¿î·Îµå |
Basset :: ±â°è ¼øÀ§ ¹× ¿ä¾à
- ƯÇã:
- Perl Artistic License
- °Ô½ÃÀÚ À̸§:
- Jim Thomason
- °Ô½ÃÀÚ À¥»çÀÌÆ®:
- http://search.cpan.org/~jimt/Basset-1.04/lib/Basset/Machine.pm
Basset :: ±â°è ű×
Basset :: ±â°è ¼³¸í
Basset :: MachineÀº ±â°è¸¦ ÁÖ¿¡ »ç¿ëÇÏ´Â Perl ¸ðµâÀÔ´Ï´Ù. Basset :: MachineÀº STATE MACHINES¿¡ »ç¿ëµÇ´Â PERL ¸ðµâÀÔ´Ï´Ù .SYNOPSISAN ¿¹Á¦°¡ °¡Àå ÁÁ½À´Ï´Ù. ´Ü¼øÇÑ °ÍÀ» ½ÃµµÇØ º¾½Ã´Ù. ÆÐÅ°Áö My :: ±â°è; Basset :: Object¸¦ »ç¿ëÇϽʽÿÀ. Basset :: Object-> »ó¼Ó (__ ÆÐÅ°Áö __, '½Ã½ºÅÛ'); ÇÏÀ§ ½ÃÀÛ {¹Ýȯ ½ÃÇÁÆ® -> »óÅ ( '·Î±×ÀÎ'); } ÇÏÀ§ ·Î±×ÀÎ {³» $ self = shift; ³» $ heap = $ self-> heap; if ($ heap -> { 'loggedin'}) {$ self-> state ( '¼º°ø'); } else {$ self-> state ( 'ÇÁ·ÒÇÁÆ®'); }} ÇÏÀ§ ÇÁ·ÒÇÁÆ® {³» $ self = shift; Àμâ "»ç¿ëÀÚ À̸§À» ÀÔ·ÂÇϽʽÿÀ ( '¹ä'À̾î¾ß ÇÔ) :"; Chomp (My $ name =); $ self-> {Èü '} -> {'loggedin '= 1 $ name eq'bob '; $ self-> »óÅ ( '·Î±×ÀÎ')¸¦ ¹ÝȯÇÕ´Ï´Ù. } Sub Success {My $ self = shift; "´ç½ÅÀº ·Î±×ÀÎ ÇÑ ¿©°ü"À» ÀμâÇÕ´Ï´Ù. $ self-> terminate ¸®ÅÏ; } 1; --- #! / usr / bin / perl ³» :: ±â°è; My :: Machine-> ½ÇÇà; ¿ä±¸ »çÇ× : ¡¤ Perl.
Basset :: ±â°è °ü·Ã ¼ÒÇÁÆ®¿þ¾î