ÆĽº :: IRC.IRC ÇÁ·ÎÅäÄÝ ¿ë Æļ | |
Áö±Ý ´Ù¿î·Îµå |
ÆĽº :: IRC. ¼øÀ§ ¹× ¿ä¾à
±¤°í
- ƯÇã:
- Perl Artistic License
- °¡°Ý:
- FREE
- °Ô½ÃÀÚ À̸§:
- Chris Williams
- °Ô½ÃÀÚ À¥»çÀÌÆ®:
- http://search.cpan.org/~bingos/
ÆĽº :: IRC. ű×
ÆĽº :: IRC. ¼³¸í
IRC ÇÁ·ÎÅäÄÝÀ»À§ÇÑ Æļ ÆĽº :: IRC´Â IRC ÇÁ·ÎÅäÄÝÀ» ÁؼöÇÏ´Â ÅؽºÆ® ¶óÀÎÀ» Æí¸®ÇÏ°Ô ±¸¹® ºÐ¼®ÇÏ´Â Æí¸®ÇÑ ¹æ¹ýÀ» Á¦°øÇÏ´Â Perl ¸ðµâÀÔ´Ï´Ù (RFC1459 ¶Ç´Â RFC2812 ÂüÁ¶) .Synopsis ÀÏ¹Ý »ç¿ë¹ý : ¾ö°ÝÇÕ´Ï´Ù. ºÐ¼® :: IRC; # ±â´ÉÀû ÀÎÅÍÆäÀ̽º MY $ HASHREF = PARSE_IRC ($ IRC_STRING); # oo ÀÎÅÍÆäÀ̽º ³» $ IRC_Parser = ±¸¹® ºÐ¼® :: IRC-> new (); $ hashref = $ IRC_Parser-> ±¸¹® ºÐ¼® ($ IRC_String); ÆĽº¸¦ »ç¿ëÇÏ¿© °£´ÜÇÑ IRC º¿¿¡¼ :: IRC : # ºÐ¼®À» »ç¿ëÇÏ´Â °£´ÜÇÑ IRC º¿ :: IRC »ç¿ë ¾ö°Ý; IO :: ¼ÒÄÏÀ» »ç¿ëÇϽʽÿÀ; ºÐ¼® :: IRC; MY $ PARSER = PARSE :: IRC-> NEW (public => 1); MY % dispatch = ( 'ping'=> \ irc_ping, '001'=> \ IRC_001, 'public'=> \ erc_public); # ¼¹ö°¡ ¿¬°áÇÏ°í ÀÚ¼¼ÇÑ ³»¿ë. MY $ SERVER = "IRC.PERL.MOO"; ³» $ nick = "parseirc $$"; ³» $ login = "simple_bot"; # º¿ÀÌ °¡ÀÔ ÇÒ Ã¤³ÎÀÔ´Ï´Ù. ³» $ ä³Î = "# IRC.PM"; # IRC ¼¹ö¿¡ ¿¬°áÇϽʽÿÀ. MY $ SOCK = NEW IO :: SOCKET :: INET (PEERADDR => $ SERVER, PEERPORT => 6667, PROTO => 'TCP') ¶Ç´Â "Connect \ n"; # ¼¹ö¿¡ ·Î±×¿ÂÇϽʽÿÀ. $ sock "Nick $ nick \ r \ n"À» ÀμâÇϽʽÿÀ; Àμâ $ sock "»ç¿ëÀÚ $ ·Î±×ÀÎ 8 * : Perl IRC ÇØÅ· ·Îº¿ \ r \ n"; # ¼¹ö¿¡¼ ¶óÀÎÀ» ÀÐÀ¸½Ê½Ã¿À. while (my $ input =) {$ INPUT = ~ s / \ r \ n // g; MY $ HASHREF = $ PARSER-> PARSE ($ ÀÔ·Â); ½ºÀ§Ä¡ : {MY $ type = lc $ hashref -> {Command}; ³» @args; @args, $ hashref -> {prefix} perfix} -> {prefix}; Ǫ½Ã @ARGS, @ {$ hashref -> {params}}; if (Á¤ÀÇ µÈ $ dispatch {$ type}) {$ dispatch {$ type} -> (@ args); ¸¶Áö¸· ½ºÀ§Ä¡; } stdout Á¶ÀÎ ( '', ""IRC_ $ type : ", @args),"\ n "; }} Sub IRC_ping {My $ Server = Shift; $ sock "pong : $ server \ r \ n"À» ÀμâÇϽʽÿÀ; ¹Ýȯ 1; } Sub IRC_001 {$ _ \ n "¿¡ ¿¬°áµÈ stdout"; $ sock "$ ä³Î \ r \ n"À» ÀμâÇϽʽÿÀ; ¹Ýȯ 1; } Sub IRC_Public {³» ($ who, $ where, $ what) = @_; "$ who-to-> $ where -> $ what \ n"À» ÀμâÇϽʽÿÀ; ¹Ýȯ 1; } ¿ä±¸ »çÇ× : ¡¤ Perl.
ÆĽº :: IRC. °ü·Ã ¼ÒÇÁÆ®¿þ¾î
net :: cidr :: lookup.
IPv4 ³×Æ®¿öÅ© ¶Ç´Â È£½ºÆ®°¡ Àε¦½Ì ÇÑ Á¶È¸ Å×À̺íÀ» ±¸ÇöÇÏ´Â Perl Ŭ·¡½º ...
171