Install the perl module in CentOS 5 to support IPV6

Source: Internet
Author: User

Install the perl module in CentOS 5 to support IPV6

LWP: UserAgent is used in our product for http requests in perl code. The test shows that the following error is returned in a pure V6 environment:

Can't connect to [2001: db8: 0: 1: 10: 208: 135: 232]: 8002 (Bad hostname '[2001: db8: 0: 1: 10: 208: 135: 232] ')

After investigation, we found that some perl applications depend on IO: Socket: INET. Because this module itself does not support IPV6, some work may be required in a pure V6 environment to work. Search for CPAN, and the module Net: INET6Glue: INET_is_INET6 provides a solution to this problem. You only need to reference it in the application code.

[Plain] view plaincopy
  1. UseNet: INET6Glue: INET_is_INET6;
However, the latest version of perl in CentOS 5 is 5.8.8. This module is not available by default. The following question is how to install it?

If there is a network environment, such as on the Development machine, the simplest way is to install it directly from CPAN. The command in shell is as follows:

[Plain] view plaincopy
  1. CpanApp: cpanminus
  2. CpanmNet: INET6Glue: INET_is_INET6
The first command will be executed for a long time. Please wait patiently and you will be asked y/n in the middle. All are default.

After the second command is executed, the dependency modules installed at the same time are displayed:

[Plain] view plaincopy
  1. Fetchinghttp: // www.cpan.org/authors/id/S/SU/SULLR/Net-INET6Glue-0.603.tar.gz... OK
  2. ConfiguringNet-INET6Glue-0.603... OK
  3. ==> Founddependencies: IO: Socket: IP
  4. --> WorkingonIO: Socket: IP
  5. Fetchinghttp: // www.cpan.org/authors/id/P/PE/PEVANS/IO-Socket-IP-0.37.tar.gz... OK
  6. ConfiguringIO-Socket-IP-0.37... OK
  7. ==> Founddependencies: Socket
  8. --> WorkingonSocket
  9. Fetchinghttp: // www.cpan.org/authors/id/P/PE/PEVANS/Socket-2.018.tar.gz... OK
  10. ==> Founddependencies: ExtUtils: Constant
  11. --> WorkingonExtUtils: Constant
  12. Fetchinghttp: // www.cpan.org/authors/id/n/nw/nwclark/extutils-constant-0.23.tar.gz.. OK
  13. ConfiguringExtUtils-Constant-0.16... OK
  14. BuildingandtestingExtUtils-Constant-0.23... OK
  15. SuccessfullyinstalledExtUtils-Constant-0.23 (upgradedfrom0.17)
  16. ConfiguringSocket-2.018... OK
  17. BuildingandtestingSocket-2.018... OK
  18. SuccessfullyinstalledSocket-2.018 (upgradedfrom1.78)
  19. BuildingandtestingIO-Socket-IP-0.37... OK
  20. SuccessfullyinstalledIO-Socket-IP-0.37
  21. BuildingandtestingNet-INET6Glue-0.603... OK
  22. SuccessfullyinstalledNet-INET6Glue-0.603
  23. 4 distributionsinstalled

In the product, you need to make the perl module rpm for installation. Search for a convenient tool: cpan 2rpm, which can be downloaded from CPAN.

The following is the tgz package. If you install it through make, the command will report the following error:

Can't locate object method "interpolate" via package "Pod: Text" at./cpan 2rpm line 519.

The reason is that the interpolate Method in Pod: Text has been migrated to the Pod: Parser module. Replace Pod: Text in the Code with Pod: Parser, then make and make install are OK.

After cpan 2rpm is installed, you can turn the Net: INET6Glue: INET_is_INET6 module and its dependencies into rpm. The steps are as follows:

1. Download tgz (including dependencies). From the above installation process, we can see that there are three dependencies: ExtUtils-Constant, Socket, and IO-Socket-IP. Take ExtUtils-Constant as an example:

[Plain] view plaincopy
  1. Wgethttp: // www.cpan.org/authors/id/N/NW/NWCLARK/ExtUtils-Constant-0.23.tar.gz
2. Run cpan 2rpm [plain] view plaincopy
  1. Cpan 2rpm -- no-sign./ExtUtils-Constant-0.23.tar.gz
The result is as follows: [plain] view plaincopy
  1. -- Cpan2rpm-Ver: 2.028 --
  2. Upgradecheck
  3. Fetch: HTTP
  4. -- Module:./ExtUtils-Constant-0.23.tar.gz --
  5. Metadataretrieval
  6. ...
  7. ...
  8. + Umask022
  9. + Cd/usr/src/redhat/BUILD
  10. + Rm-rfExtUtils-Constant-0.23
  11. + Exit0
  12. RPM:/usr/src/redhat/RPMS/noarch/perl-ExtUtils-Constant-0.23-1.noarch.rpm
  13. SRPM:/usr/src/redhat/SRPMS/perl-ExtUtils-Constant-0.23-1.src.rpm
  14. -- Done --

The required rpm and source rpm are generated.

Done!

In fact, cpan 2rpm does not have to download the tgz package first, as long as you replace the above file name with the module name.

In addition, it is estimated that cpan 2rpm has not been maintained for a long time, and the following problems have been encountered during compilation of different rpms, and the patch is released together.

Error 1:

[Plain] view plaincopy
  1. Get_meta (): Notadirectoryat/usr/bin/cpan2rpmline396.
Patch:

[Plain] view plaincopy
  1. Diff-rucpan2rpm-2.028/cpan2rpmcpan2rpm-new/cpan 2rpm
  2. --- Cpan2rpm-2.028/cpan2rpm2005-06-1722: 06: 54.000000000-0700
  3. + + Cpan2rpm-new/cpan2rpm2005-06-3009: 35: 49.000000000-0700
  4. @-26,6 + 26, 7 @@
  5. Usestrict;
  6. Usewarnings;
  7. + UseFile: Basename;
  8. UseGetopt: Long;
  9. UseSys: Hostname;
  10. UsePod: Text;
  11. @-387,6 + 388, 9 @@
  12. $ Info-> {buildarch} = "noarch" if $ xs = 0;
  13. }
  14. + If (not-d $ info-> {evaldir }){
  15. + $ Info-> {evaldir} = dirname ($ info-> {evaldir });
  16. +}
  17. Chdir $ info-> {evaldir} | die "get_meta (): $! ";
  18. $ _ = "$ Info-> {evaldir}/Build. PL ";

Error 2:

[Plain] view plaincopy
  1. /Usr/lib/rpm/brp-compress: line8: cd:/var/tmp/perl-Crypt-Random-Source-0.10-root: Nosuchfileordirectory
Patch:

Add "--" to the front of destdir in Row 3.

[Plain] view plaincopy
  1. $ Info-> {"make-install" }= "-- destdir = % {buildroot }"

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.