Installing Perl Module; ÆÞ ¸ðµâ ¼³Ä¡Çϱâ
CPANµîÀ» ÅëÇØ ¹èÆ÷µÇ´Â perl ¸ðµâÀ» linux ȯ°æ¿¡¼ ¼³Ä¡ÇÏ´Â ¹æ¹ýÀ» ¼³¸íÇÕ´Ï´Ù. ±×¸®°í ¸ðµâÀ» »ç¿ëÇÏ´Â °£´ÜÇÑ ¿¹¸¦ µé¾î º¾´Ï´Ù.
ÆÞ ¸ðµâÀº Çѹø ÀÛ¼ºÇÑ Äڵ带 Àç »ç¿ëÇϱâ À§ÇØ ¾à¼ÓµÈ ¸ð¾çÀ¸·Î ¸¸µé¾î ³õÀº °ÍÀÔ´Ï´Ù. ±×¸®°í CPAN(Comprehensive
Perl Archive Network)Àº ÀÛ¼ºÇÑ ÆÞ¸ðµâÀ» ¸ð¾Æ³õÀº °÷(?)ÀÔ´Ï´Ù. ÄÚµå ÀÚü¿¡ ´ëÇÏ¿© ±âº»ÀûÀÎ Å×½ºÆ®¿Í ±âº»ÀûÀÎ Æ÷¸äÀ» µû¸£´Â ¸ðµâµéÀÌ ¸ð¿© ÀÖ½À´Ï´Ù.
µî·ÏµÈ ¸ðµâÀº »ó´çÈ÷ ¸¹À¸¸ç(2001³â1¿ù ÇöÀç 700¸Þ°¡°¡ ³Ñ´Â´Ù Çϳ׿©) Ä«Å×°í¸®º°, ¸ðµâ À̸§º°·Î ºÐ·ùµÇ¾î ÀÖ½À´Ï´Ù. ¾ÆÁÖ Æ¯ÀÌÇÏÁö ¾ÊÀº °ÍÀ» Á¦¿ÜÇÏ°í´Â CPAN¿¡¼ ¿øÇÏ´Â ¸ðµâÀ» ãÀ» ¼ö ÀÖÀ» °ÍÀÔ´Ï´Ù.
CAPNÀÇ URLÀº ´ÙÀ½°ú °°½À´Ï´Ù.
http://www.cpan.org
±×¸®°í ´ÙÀ½ URLÀº CPAN ¾ÈÀÇ ¸ðµâÀ» °Ë»öÇØ ÁÖ´Â °÷ÀÔ´Ï´Ù.
http://search.cpan.org/
cpan »çÀÌÆ®¿¡¼ ¿øÇÏ´Â ¸ðµâÀ» ã¾Æ¼ ´Ù¿î·Îµå ¹Þ½À´Ï´Ù.
ÀÌ ¹®¼¿¡¼´Â ¿¹Á¦·Î Net::FTP ¸ðµâÀ» ´ë»óÀ¸·Î ÇÕ´Ï´Ù. Net::FTP¿Í °°ÀÌ ¸ðµâÀ̸§¿¡ ¡¯::¡¯°¡ ÀÖ´Â °æ¿ì´Â »óÀ§ ¸ðµâ¾È¿¡ ÇÏÀ§ ¸ðµâ FTP°¡ Æ÷ÇÔµÈ °æ¿ìÀÔ´Ï´Ù. ÀÌ·± °æ¿ì Net::FTP ¸ðµâÀÌ º°µµ·Î Á¸ÀçÇÏÁö ¾Ê°í »óÀ§ÀÇ ¸ðµâÀ» ¼³Ä¡ÇØ¾ß ÇÏ´Â °æ¿ìµµ ÀÖ½À´Ï´Ù. ±×¸®°í »óÀ§ÀÇ ¸ðµâÀÇ À̸§ÀÌ ´Ù¸¥ °æ¿ìµµ ÀÖ½À´Ï´Ù.
À§¿¡¼ ¾ð±ÞÇÑ http://searceh.cpan.orgÀÇ °Ë»öÄ¿¡ Net::FTP¸¦ Å°¿öµå·Î °Ë»öÀ» Çغ¸´Ï libnet-1.0703¶õ ¸ðµâ ¾È¿¡ Net::FTP°¡ Æ÷ÇԵǾî Àֳ׿ä.
±×·¡¼ libnet-1.0703.tar.gz ¸ðµâÀ» ¼³Ä¡ÇÏ°íÀÚ ÇÏ´Â linux¼¹ö·Î ´Ù¿î·Îµå ¹Þ½À´Ï´Ù.
ÈÀÏÀÇ À̸§Àº ´ÙÀ½°ú °°ÀÌ Çؼ®ÇÏ¸é µË´Ï´Ù.
libnet : ¸ðµâ À̸§ -1.0703 : ¸ðµâ ¹öÀü À̸§. ´ëºÎºÐ ÇÏÀ§ ¹öÀüÀÇ ¸ðµâµµ Á¦°øµË´Ï´Ù. °¡Àå »óÀ§ ¹öÀüÀ» °¡Á®¿À¸é µÇ°ÚÁÒ. .tar.gz : tar·Î ÈÀÏÀ» ¹°í gzipÀ¸·Î ¾ÐÃàÇ߳׿©.
perlÀº ¸ðµâÀ» »ç¿ëÇÒ ¶§ @INCÀÇ µð·ºÅ丮¿¡¼ ¸ðµâ¿¡ ÇØ´çÇÏ´Â ÈÀÏÀ» ã°í, ãÁö ¸øÇÒ °æ¿ì ½ÇÇàµÇ´Â perl ½ºÅ©¸³Æ®°¡ ÀÖ´Â µð·ºÅ丮¿¡¼ ¿øÇÏ´Â ¸ðµâ ÈÀÏÀ» ã½À´Ï´Ù. @INC´Â ´ÙÀ½°ú °°ÁÒ(RedHat 6.2ÀÇ °æ¿ì).
/usr/lib/perl5/5.00503/i386-linux /usr/lib/perl5/5.00503 /usr/lib/perl5/site_perl/5.005/i386-linux /usr/lib/perl5/site_perl/5.005 ±×·±µ¥ À§ÀÇ µð·ºÅ丮¿¡ ¸ðµâÀ» ¼³Ä¡ÇÏ·Á¸é rootÀÇ ±ÇÇÑÀÌ ÇÊ¿äÇÕ´Ï´Ù.
ÇÏÁö¸¸ root°¡ ¾Æ´Ñ ÀÏ¹Ý À¯Àú¶óµµ ÀÚ½ÅÀÌ ¾²±â ±ÇÇÑÀÌ ÀÖ´Â µð·ºÅ丮¿¡ ¸ðµâÀ» ¼³Ä¡ÇÏ¿© »ç¿ëÇÒ ¼ö ÀÖ½À´Ï´Ù. ÀÌ¿¡ ´ëÇÑ »çÇ×Àº µÚ¿¡¼ ¼³¸íÇÕ´Ï´Ù.
root·Î ·Î±×ÀÎÇÏ°í
$ su - root
´Ù¿î·ÎµåÇÑ ÈÀÏÀ» Ç®°í
$ tar xvfz libnet-1.0703.tar.gz
¾ÐÃàÀÌ Ç®¸° µð·ºÅ丮·Î À̵¿ÇÕ´Ï´Ù.(º¸Åë ¾ÐÃàÀÌ Ç®¸®¸é¼ »õ·Î »ý¼ºµÈ µð·ºÅ丮ÀÇ À̸§Àº ´Ù¿î·ÎµåÇÑ ÈÀÏÀ̸§¿¡¼ .tar.gz¸¦ Á¦¿ÜÇÑ °ÍÀÔ´Ï´Ù.)
$ cd libnet-1.0703
READMEÈÀÏÀ» ÀÐ¾î º¾´Ï´Ù. ´ëºÎºÐÀÇ ¸ðµâÀÇ °æ¿ì ¼³Ä¡ ¹æ¹ýÀÌ ¿©±â¼ ¿¹¸¦ µå´Â °Í°ú °°Áö¸¸ ƯÀÌÇÑ °æ¿ìµµ ÀÖ½À´Ï´Ù. ´ëÃæÀÌ¶óµµ ÈÈ¾î º¸½Ã´Â °ÍÀÌ ÁÁ½À´Ï´Ù. libnet ¸ðµâÀÇ °æ¿ì ƯÀÌÇÑ °ÍÀº ¾ø³×¿ä.
¼³Ä¡¸¦ À§ÇÑ È¯°æÀ» üũÇÕ´Ï´Ù.
$ perl Makefile.PL Checking for Socket...ok Checking for IO::Socket...ok Writing Makefile for Net
¾î¶² ¸ðµâÀÇ °æ¿ì ¼³Ä¡Çϱâ À§Çؼ´Â ƯÁ¤ ¶óÀ̺귯¸®¸¦ ÇÊ¿ä·Î Çϱ⵵ ÇÏ°í, ȤÀº ´Ù¸¥ ¸ðµâÀ» ÇÊ¿ä·Î Çϱ⵵ ÇÕ´Ï´Ù. ÀÌ·± °æ¿ì¿¡´Â ¸Þ½ÃÁö ³»¿ëÀ» Àß º¸°í ÇÊ¿äÇÑ ¸ðµâÀ» ¼³Ä¡ÇÕ´Ï´Ù. ¶óÀ̺귯¸®°¡ ÇÊ¿äÇÑ °æ¿ì´Â ÇØ´çÇÏ´Â °Í ¿ª½Ã ¼³Ä¡ÇØ¾ß °ÙÁÒ.
ÄÄÆÄÀÏ ÇÕ´Ï´Ù.
$ make Manifying blib/man3/Net::Time.3 Manifying blib/man3/Net::PH.3 Manifying blib/man3/Net::Domain.3 Manifying blib/man3/Net::NNTP.3 Manifying blib/man3/Net::DummyInetd.3 Manifying blib/man3/Net::SNPP.3 Manifying blib/man3/Net::FTP.3 Manifying blib/man3/Net::POP3.3 Manifying blib/man3/Net::libnetFAQ.3 Manifying blib/man3/Net::Netrc.3 Manifying blib/man3/Net::SMTP.3 Manifying blib/man3/Net::Cmd.3
±×¸®°í ½ÇÁ¦·Î ¼³Ä¡Çϱâ Àü¿¡ Á¦´ë·Î µ¿ÀÛÇÏ´ÂÁö Å×½ºÆ® ÇÕ´Ï´Ù.
$ make test PERL_DL_NONLAZY=1 /usr/bin/perl -Iblib/arch -Iblib/lib -I/usr/lib/perl5/5.00503/i386-linux -I/usr/lib/perl5/5.00503 -e ¡¯use Test::Harness qw(&runtests $verbose); $verbose=0; runtests @ARGV;¡¯ t/*.t t/ftp...............skipping test on this platform t/hostname..........ok t/nntp..............skipping test on this platform t/ph................skipping test on this platform t/require...........ok t/smtp..............skipping test on this platform All tests successful, 4 tests skipped. Files=6, Tests=12, 3 wallclock secs ( 1.05 cusr + 0.11 csys = 1.16 CPU)
Å×½ºÆ® °á°ú ¹®Á¦°¡ ¾ø³×¿ä. ¿©±â±îÁö´Â ¸ðµç °ÍÀÌ ÇöÀçÀÇ µð·ºÅ丮 ¾È¿¡¼ ÁøÇàµË´Ï´Ù. ´ÜÁö ¼³Á¤ÇÏ°í, ÄÄÆÄÀÏÇÏ°í, Å×½ºÆ® ÇغÃÀ» »ÓÀÔ´Ï´Ù. ½ÇÁ¦·Î ¼³Ä¡ÇÑ°ÍÀÌ ¾Æ´ÏÁÒ.
ÀÌÁ¦ ¼³Ä¡ÇÕ´Ï´Ù.
$ make install Writing /usr/lib/perl5/site_perl/5.005/Net/DummyInetd.pm Writing /usr/lib/perl5/site_perl/5.005/Net/NNTP.pm Writing /usr/lib/perl5/site_perl/5.005/Net/FTP/dataconn.pm Writing /usr/lib/perl5/site_perl/5.005/Net/FTP/I.pm Writing /usr/lib/perl5/site_perl/5.005/Net/FTP/L.pm Writing /usr/lib/perl5/site_perl/5.005/Net/FTP/A.pm Writing /usr/lib/perl5/site_perl/5.005/Net/FTP/E.pm Writing /usr/lib/perl5/site_perl/5.005/Net/SNPP.pm Writing /usr/lib/perl5/site_perl/5.005/Net/POP3.pm Writing /usr/lib/perl5/site_perl/5.005/Net/SMTP.pm Writing /usr/lib/perl5/site_perl/5.005/Net/FTP.pm Writing /usr/lib/perl5/site_perl/5.005/Net/Time.pm Writing /usr/lib/perl5/site_perl/5.005/Net/Cmd.pm Writing /usr/lib/perl5/site_perl/5.005/Net/Config.pm Writing /usr/lib/perl5/site_perl/5.005/Net/PH.pm Writing /usr/lib/perl5/site_perl/5.005/Net/Domain.pm Writing /usr/lib/perl5/site_perl/5.005/Net/libnet.cfg Writing /usr/lib/perl5/site_perl/5.005/Net/Netrc.pm Writing /usr/lib/perl5/site_perl/5.005/Net/libnetFAQ.pod Writing /usr/lib/perl5/man/man3/Net::Time.3 Writing /usr/lib/perl5/man/man3/Net::PH.3 Writing /usr/lib/perl5/man/man3/Net::Domain.3 Writing /usr/lib/perl5/man/man3/Net::NNTP.3 Writing /usr/lib/perl5/man/man3/Net::DummyInetd.3 Writing /usr/lib/perl5/man/man3/Net::SNPP.3 Writing /usr/lib/perl5/man/man3/Net::FTP.3 Writing /usr/lib/perl5/man/man3/Net::POP3.3 Writing /usr/lib/perl5/man/man3/Net::libnetFAQ.3 Writing /usr/lib/perl5/man/man3/Net::Netrc.3 Writing /usr/lib/perl5/man/man3/Net::SMTP.3 Writing /usr/lib/perl5/man/man3/Net::Cmd.3 Writing /usr/lib/perl5/site_perl/5.005/i386-linux/auto/Net/.packlist Appending installation info to /usr/lib/perl5/5.00503/i386-linux/perllocal.pod
½ÇÁ¦·Î »ý¼ºµÈ ÈÀÏÀÇ ¸®½ºÆ®°¡ º¸À̳׿ä.
º°´Ù¸¥ ¹®Á¦¾øÀÌ ¼³Ä¡°¡ ³¡³µ½À´Ï´Ù.
ÀÏ´Ü ´ÙÀ½°ú °°Àº °£´ÜÇÑ ½ºÅ©¸³Æ®·Î ¼³Ä¡°¡ Á¦´ë·Î µÆ´ÂÁö È®ÀÎÇÕ´Ï´Ù.
#!/usr/bin/perl use Net::FTP;
¾Æ¹«·± ¸Þ½ÃÁö°¡ ¾ø´Â °É º¸´Ï ¼³Ä¡°¡ ÀߵƳ׿ä.
À§ÀÇ ¿¹¿¡¼ Net::FTP ¸ðµâÀ» »ç¿ëÇÏ°Ú´Ù°í
use Net::FTP;
·Î ¼±¾ðÇØ Áá½À´Ï´Ù. ±×·±µ¥ ¼³Ä¡ÇÒ ¶§ º¸¿©ÁØ ´ÙÀ½ ¸Þ½ÃÁö¸¦ »ìÆì º¾½Ã´Ù.
Writing /usr/lib/perl5/site_perl/5.005/Net/FTP.pm
/usr/bin/perl5/site_perl/5.005/Net µð·ºÅ丮¿¡ FTP.pm ÈÀÏÀ» ½è´Ù´Â °Å³×¿ä. /usr/bin/perl5/site_perl/5.005/Net µð·ºÅ丮´Â @INC¿¡ Æ÷ÇÔµÈ µð·ºÅ丮ÀÔ´Ï´Ù.
±×·¯°í º¸´Ï Net::FTP¿¡¼ Net´Â µð·ºÅ丮 À̸§ÀÌ°í FTP´Â FTP.pm¿¡¼ ÈÀåÀÚ¸¦ »« ºÎºÐ°ú °°½À´Ï´Ù.
½ÇÁ¦·Î À§ÀÇ FTP.pm ÈÀÏÀ» ¿¡µðÅÍ·Î ¿¾îº¸¸é perl ¼Ò½º¸¦ º¸½Ç ¼ö ÀÖ½À´Ï´Ù.
¸ðµâÀÌ ¼³Ä¡µÇ¸é ¸Þ´º¾óµµ °°ÀÌ ¼³Ä¡ µË´Ï´Ù. ´ÙÀ½ÀÇ ¸í·ÉÀ¸·Î ¸Þ´º¾óÀ» º¼ ¼ö ÀÖ½À´Ï´Ù.
$ man Net::FTP
º¸Åë SYNOPSIS ºÎºÐ¿¡ ´ÙÀ½°ú °°ÀÌ °£´ÜÇÑ »ç¿ë ¿¹°¡ ³ª¿Í ÀÖ½À´Ï´Ù.
SYNOPSIS use Net::FTP;
$ftp = Net::FTP->new("some.host.name", Debug => 0); $ftp->login("anonymous",¡¯me@here.there¡¯); $ftp->cwd("/pub"); $ftp->get("that.file"); $ftp->quit;
À§ÀÇ ¿¹¸¦ º¸°í ½ÇÁ¦·Î µ¿ÀÛÇÏ´Â Äڵ带 ÀÛ¼ºÇØ º¾½Ã´Ù.
#!/usr/bin/perl use Net::FTP;
$ftp = Net::FTP->new("ftp.microsoft.com"); $ftp->login("anonymous","id@yourmail.address.com"); $ftp->cwd("/interix"); $ftp->get("lgpl.txt"); $ftp->quit;
½ÇÇàÀÌ ³¡³ª°í ÇöÀç µð·ºÅ丮ÀÇ ÈÀÏÀ» »ìÆ캸´Ï lgpl.txt¶ó´Â ÈÀÏÀÌ Àֳ׿ä. Á¦´ë·Î ¸ðµâÀÌ µ¿ÀÛÇ߳׿©.
¾ÐÃàÀ» Ǫ´Â °Í ±îÁö´Â À§¿Í °°½À´Ï´Ù. ¼³Ä¡ÇÒ ÀÏ¹Ý À¯Àú °èÁ¤Àº normal_userÀÔ´Ï´Ù. READMEÈÀÏÀ» Àо´Ï ¼³Ä¡ÇÒ À§Ä¡¸¦ ´ÙÀ½°ú °°ÀÌ ¼³Á¤Ç϶ó°í ÇÕ´Ï´Ù.
perl Makefile.PL PREFIX=~/perl
ÇØ º¾½Ã´Ù.
$ perl Makefile.PL PREFIX=~/perl Checking for Socket...ok Checking for IO::Socket...ok Writing Makefile for Net
´ÙÀ½Àº ¿ª½Ã ¸¶Âù°¡Áö ÀÔ´Ï´Ù.
$ make $ make test
$ libnet-1.0703]$ make install Installing /home/normal_user/perl/lib/site_perl/5.005/Net/DummyInetd.pm Installing /home/normal_user/perl/lib/site_perl/5.005/Net/NNTP.pm Installing /home/normal_user/perl/lib/site_perl/5.005/Net/FTP/dataconn.pm Installing /home/normal_user/perl/lib/site_perl/5.005/Net/FTP/I.pm Installing /home/normal_user/perl/lib/site_perl/5.005/Net/FTP/L.pm Installing /home/normal_user/perl/lib/site_perl/5.005/Net/FTP/A.pm Installing /home/normal_user/perl/lib/site_perl/5.005/Net/FTP/E.pm Installing /home/normal_user/perl/lib/site_perl/5.005/Net/SNPP.pm Installing /home/normal_user/perl/lib/site_perl/5.005/Net/POP3.pm Installing /home/normal_user/perl/lib/site_perl/5.005/Net/SMTP.pm Installing /home/normal_user/perl/lib/site_perl/5.005/Net/FTP.pm Installing /home/normal_user/perl/lib/site_perl/5.005/Net/Time.pm Installing /home/normal_user/perl/lib/site_perl/5.005/Net/Cmd.pm Installing /home/normal_user/perl/lib/site_perl/5.005/Net/Config.pm Installing /home/normal_user/perl/lib/site_perl/5.005/Net/PH.pm Installing /home/normal_user/perl/lib/site_perl/5.005/Net/Domain.pm Installing /home/normal_user/perl/lib/site_perl/5.005/Net/libnet.cfg Installing /home/normal_user/perl/lib/site_perl/5.005/Net/Netrc.pm Installing /home/normal_user/perl/lib/site_perl/5.005/Net/libnetFAQ.pod Installing /home/normal_user/perl/lib/perl5/man/man3/Net::Time.3 Installing /home/normal_user/perl/lib/perl5/man/man3/Net::PH.3 Installing /home/normal_user/perl/lib/perl5/man/man3/Net::Domain.3 Installing /home/normal_user/perl/lib/perl5/man/man3/Net::NNTP.3 Installing /home/normal_user/perl/lib/perl5/man/man3/Net::DummyInetd.3 Installing /home/normal_user/perl/lib/perl5/man/man3/Net::SNPP.3 Installing /home/normal_user/perl/lib/perl5/man/man3/Net::FTP.3 Installing /home/normal_user/perl/lib/perl5/man/man3/Net::POP3.3 Installing /home/normal_user/perl/lib/perl5/man/man3/Net::libnetFAQ.3 Installing /home/normal_user/perl/lib/perl5/man/man3/Net::Netrc.3 Installing /home/normal_user/perl/lib/perl5/man/man3/Net::SMTP.3 Installing /home/normal_user/perl/lib/perl5/man/man3/Net::Cmd.3 Writing /home/normal_user/perl/lib/site_perl/5.005/i386-linux/auto/Net/.packlist /bin/sh: /home/normal_user/perl/lib/5.00503/i386-linux/perllocal.pod: ±×·± ÆÄÀÏÀ̳ª µð·ºÅä ¸®°¡ ¾øÀ½ make: [doc_site_install] Error 1 (ignored) Appending installation info to /home/normal_user/perl/lib/5.00503/i386-linux/perllocal.pod
root°¡ ¼³Ä¡ÇÑ ³»¿ë°ú ºñ±³ÇØ º¸¸é ¼³Ä¡µÈ À§Ä¡°¡ /usr°¡ ¾Æ´Ñ /home/normal_user/perlÀ̳׿ä.
¿ª½Ã ½ºÅ©¸³Æ®·Î Å×½ºÆ® ÇØ º¾½Ã´Ù.
#!/usr/bin/perl use Net::FTP;
$ftp = Net::FTP->new("ftp.microsoft.com"); $ftp->login("anonymous","id@yourmail.address.com"); $ftp->cwd("/interix"); $ftp->get("lgpl.txt"); $ftp->quit;
½ÇÇà °á°ú
Can¡¯t locate Net/FTP.pm in @INC (@INC contains: /usr/lib/perl5/5.00503/i386-linux /usr/lib/perl5/5.00503 /usr/lib/perl5/site_perl/5.005/i386-linux /usr/lib/perl5/site_perl/5.005 .) at ./test.pl line 3. BEGIN failed--compilation aborted at ./test.pl line 3.
´ç¿¬ÇÑ °á°úÁÒ. @INCÀÇ µð·ºÅ丮¿¡ ¼³Ä¡ÇÏÁö ¾Ê¾ÒÀ¸´Ï FTP.pm ÈÀÏÀ» ãÁö ¸øÇÑ´Ù´Â °Í. ´ÙÀ½°ú °°ÀÌ ¼³Ä¡µÈ µð·ºÅ丮¸¦ @INC¿¡ Ãß°¡ÇսôÙ.
BEGIN { unshift(@INC, ¡¯/home/normal_user/perl/lib/site_perl/5.005¡¯); } use Net::FTP;
Á¦´ë·Î µ¿ÀÛÇß½À´Ï´Ù.
ÀÓµµÇü
dhrim@vipstock.com dh-rim@hanmail.net
2001³â 3¿ù 5ÀÏ