• 手把手一起玩perl安装


    1、安装之前,先检查一下当前系统中Perl的版本

    [root@arcerzhang ~]# perl -v
    
    This is perl, v5.10.1 (*) built for x86_64-linux-thread-multi
    
    Copyright 1987-2009, Larry Wall
    
    Perl may be copied only under the terms of either the Artistic License or the
    GNU General Public License, which may be found in the Perl 5 source kit.
    
    Complete documentation for Perl, including FAQ lists, should be found on
    this system using "man perl" or "perldoc perl".  If you have access to the
    Internet, point your browser at http://www.perl.org/, the Perl Home Page.
    View Code

    2、执行脚本,验证当前系统中安装了哪些Perl modules?

    #!/usr/bin/perl
    use strict;
    use ExtUtils::Installed;
    
    my $inst=ExtUtils::Installed->new();
    
    my @modules = $inst->modules();
    
    foreach(@modules){
            my $ver = $inst->version($_) || "???";
            printf("%-12s -- %s
    ",$_,$ver);
    }
    
    exit;
    View Code
    [root@arcerzhang scripts]# /root/scripts/chk2.pl 
    DBI          -- 1.627
    Perl         -- 5.10.1
    View Code

    3、安装模块DBI-1.627.tar.gz,具体安装包自行到官方网站下载(www.cpan.org)

    具体安装步骤

    1. perl Makefile.PL
    2. make
    3. make test
    4. make test TEST_VERBOSE=1(if any of the t/* tests fail)
    5. make install (if the tests look okay)

    安装完成后,可以再次执行验证脚本,查看时候已经安装成功DBI模块

    [root@arcerzhang scripts]# /root/scripts/chk2.pl 
    DBI          -- 1.627
    Perl         -- 5.10.1
    View Code

    4、安装模块DBD-Oracle-1.64.tar.gz,具体安装包自行到官方网站下载(www.cpan.org)   

    首先在安装DBD-Oracle-1.64.tar.gz之前,需要先安装oracle 的example的包; 

    [root@arcerzhang DBD-Oracle-1.64]# export ORACLE_HOME='/u01/oracle'
    [root@arcerzhang DBD-Oracle-1.64]# export ORACLE_USERID='SCOTT/TIGER@DB234'
    [root@arcerzhang DBD-Oracle-1.64]# export path=$ORACLE_HOME/bin:$PATH
    [root@arcerzhang DBD-Oracle-1.64]# export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH
    配置环境变量
    [root@arcerzhang DBD-Oracle-1.64]# perl Makefile.PL
    Multiple copies of Driver.xst found in: /usr/local/lib64/perl5/auto/DBI/ /usr/lib64/perl5/auto/DBI/ at Makefile.PL line 39
    Using DBI 1.627 (for perl 5.010001 on x86_64-linux-thread-multi) installed in /usr/local/lib64/perl5/auto/DBI/
    
    Configuring DBD::Oracle for perl 5.010001 on linux (x86_64-linux-thread-multi)
    
    Remember to actually *READ* the README file! Especially if you have any problems.
    
    Installing on a linux, Ver#2.6
    Using Oracle in /u01/oracle
    DEFINE _SQLPLUS_RELEASE = "1102000100" (CHAR)
    Oracle version 11.2.0.1 (11.2)
    Found /u01/oracle/rdbms/demo/demo_rdbms.mk
    Found /u01/oracle/rdbms/demo/demo_rdbms64.mk
    Found /u01/oracle/rdbms/lib/ins_rdbms.mk
    Using /u01/oracle/rdbms/demo/demo_rdbms.mk
    Your LD_LIBRARY_PATH env var is set to '/u01/oracle/lib:'
    Reading /u01/oracle/rdbms/demo/demo_rdbms.mk
    Reading /u01/oracle/rdbms/lib/env_rdbms.mk
    
    Attempting to discover Oracle OCI build rules
    gcc    -c -o DBD_ORA_OBJ.o DBD_ORA_OBJ.c
    by executing: [make -f /u01/oracle/rdbms/demo/demo_rdbms.mk build ECHODO=echo ECHO=echo GENCLNTSH='echo genclntsh' CC=true OPTIMIZE= CCFLAGS= EXE=DBD_ORA_EXE OBJS=DBD_ORA_OBJ.o]
    Oracle oci build command:
            [true -L/u01/oracle/lib/ -L/u01/oracle/rdbms/lib/ -o DBD_ORA_EXE DBD_ORA_OBJ.o -lclntsh   `cat /u01/oracle/lib/sysliblist` -ldl -lm  -lpthread]
    
    Found header files in /u01/oracle/rdbms/public.
    
    client_version=11.2
    
    
    DEFINE= -Wall -Wno-comment -DUTF8_SUPPORT -DORA_OCI_VERSION="11.2.0.1" -DORA_OCI_102 -DORA_OCI_112
    
    
    Checking for functioning wait.ph
    
    
    System: perl5.010001 linux c6b8.bsys.dev.centos.org 2.6.32-220.el6.x86_64 #1 smp tue dec 6 19:48:22 gmt 2011 x86_64 x86_64 x86_64 gnulinux
    Compiler:   gcc -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
    Linker:     /usr/bin/ld
    Sysliblist: -ldl -lm -lpthread -lnsl -lirc -lipgo -lsvml
    Oracle makefiles would have used these definitions but we override them:
      CC:       $(COMPDIR)/bin/gcc
      CFLAGS:   $(GFLAG) $(OPTIMIZE) $(CDEBUG) $(CCFLAGS) $(PFLAGS)
            $(SHARED_CFLAG) $(USRFLAGS)
               [$(GFLAG) -O3 $(CDEBUG) -m32 -trigraphs -fPIC -I/u01/oracle/rdbms/demo -I/u01/oracle/rdbms/public -I/u01/oracle/plsql/public -I/u01/oracle/network/public -DLINUX -D_GNU_SOURCE -D_LARGEFILE64_SOURCE=1 -D_LARGEFILE_SOURCE=1 -DSLTS_ENABLE -DSLMXMX_ENABLE -D_REENTRANT -DNS_THREADS -D__NO_CTYPE=1 -DLDAP_CM $(LPFLAGS) $(PLSQLNCGFLAGS) $(USRFLAGS)]
      LDFLAGS:  $(LDFLAGS32)
               [-m32 -o $@ -L/u01/oracle/rdbms//lib32/ -L/u01/oracle/lib32/ -L/u01/oracle/lib32/stubs/]
    Linking with OTHERLDFLAGS = -L/u01/oracle/lib/ -L/u01/oracle/rdbms/lib/   -lclntsh   `cat /u01/oracle/lib/sysliblist` -ldl -lm  -lpthread [from 'build' rule]
    
    Checking if your kit is complete...
    Looks good
    LD_RUN_PATH=/u01/oracle/lib:/u01/oracle/rdbms/lib
    Using DBD::Oracle 1.64.
    Using DBD::Oracle 1.64.
    Multiple copies of Driver.xst found in: /usr/local/lib64/perl5/auto/DBI/ /usr/lib64/perl5/auto/DBI/ at Makefile.PL line 1789
    Using DBI 1.627 (for perl 5.010001 on x86_64-linux-thread-multi) installed in /usr/local/lib64/perl5/auto/DBI/
    Writing Makefile for DBD::Oracle
    
    ***  If you have problems...
         read all the log printed above, and the README and README.help.txt files.
         (Of course, you have read README by now anyway, haven't you?)
    perl Makefile.PL
    [root@arcerzhang DBD-Oracle-1.64]# make
    cp lib/DBD/Oracle/Troubleshooting/Cygwin.pod blib/lib/DBD/Oracle/Troubleshooting/Cygwin.pod
    cp lib/DBD/Oracle.pm blib/lib/DBD/Oracle.pm
    cp Oracle.h blib/arch/auto/DBD/Oracle/Oracle.h
    cp lib/DBD/Oracle/Troubleshooting/Vms.pod blib/lib/DBD/Oracle/Troubleshooting/Vms.pod
    cp lib/DBD/Oracle/Troubleshooting/Hpux.pod blib/lib/DBD/Oracle/Troubleshooting/Hpux.pod
    cp lib/DBD/Oracle/Troubleshooting/Linux.pod blib/lib/DBD/Oracle/Troubleshooting/Linux.pod
    cp lib/DBD/Oracle/GetInfo.pm blib/lib/DBD/Oracle/GetInfo.pm
    cp lib/DBD/Oracle/Troubleshooting.pod blib/lib/DBD/Oracle/Troubleshooting.pod
    cp dbdimp.h blib/arch/auto/DBD/Oracle/dbdimp.h
    cp ocitrace.h blib/arch/auto/DBD/Oracle/ocitrace.h
    cp lib/DBD/Oracle/Troubleshooting/Sun.pod blib/lib/DBD/Oracle/Troubleshooting/Sun.pod
    cp lib/DBD/Oracle/Troubleshooting/Macos.pod blib/lib/DBD/Oracle/Troubleshooting/Macos.pod
    cp lib/DBD/Oracle/Object.pm blib/lib/DBD/Oracle/Object.pm
    cp lib/DBD/Oracle/Troubleshooting/Aix.pod blib/lib/DBD/Oracle/Troubleshooting/Aix.pod
    cp lib/DBD/Oracle/Troubleshooting/Win64.pod blib/lib/DBD/Oracle/Troubleshooting/Win64.pod
    cp lib/DBD/Oracle/Troubleshooting/Win32.pod blib/lib/DBD/Oracle/Troubleshooting/Win32.pod
    cp mk.pm blib/arch/auto/DBD/Oracle/mk.pm
    /usr/bin/perl -p -e "s/~DRIVER~/Oracle/g" /usr/local/lib64/perl5/auto/DBI/Driver.xst > Oracle.xsi
    /usr/bin/perl /usr/share/perl5/ExtUtils/xsubpp  -typemap /usr/share/perl5/ExtUtils/typemap -typemap typemap  Oracle.xs > Oracle.xsc && mv Oracle.xsc Oracle.c
    gcc -c  -I/u01/oracle/rdbms/public -I/u01/oracle/rdbms/demo -I/u01/oracle/rdbms/public -I/u01/oracle/plsql/public -I/u01/oracle/network/public -I/usr/local/lib64/perl5/auto/DBI -D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic   -DVERSION="1.64" -DXS_VERSION="1.64" -fPIC "-I/usr/lib64/perl5/CORE"  -Wall -Wno-comment -DUTF8_SUPPORT -DORA_OCI_VERSION="11.2.0.1" -DORA_OCI_102 -DORA_OCI_112 Oracle.c
    gcc -c  -I/u01/oracle/rdbms/public -I/u01/oracle/rdbms/demo -I/u01/oracle/rdbms/public -I/u01/oracle/plsql/public -I/u01/oracle/network/public -I/usr/local/lib64/perl5/auto/DBI -D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic   -DVERSION="1.64" -DXS_VERSION="1.64" -fPIC "-I/usr/lib64/perl5/CORE"  -Wall -Wno-comment -DUTF8_SUPPORT -DORA_OCI_VERSION="11.2.0.1" -DORA_OCI_102 -DORA_OCI_112 dbdimp.c
    dbdimp.c: In function ‘ora_db_login6’:
    dbdimp.c:721: warning: format ‘%d’ expects type ‘int’, but argument 12 has type ‘size_t’
    dbdimp.c:721: warning: format ‘%d’ expects type ‘int’, but argument 14 has type ‘size_t’
    gcc -c  -I/u01/oracle/rdbms/public -I/u01/oracle/rdbms/demo -I/u01/oracle/rdbms/public -I/u01/oracle/plsql/public -I/u01/oracle/network/public -I/usr/local/lib64/perl5/auto/DBI -D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic   -DVERSION="1.64" -DXS_VERSION="1.64" -fPIC "-I/usr/lib64/perl5/CORE"  -Wall -Wno-comment -DUTF8_SUPPORT -DORA_OCI_VERSION="11.2.0.1" -DORA_OCI_102 -DORA_OCI_112 oci8.c
    oci8.c: In function ‘ora_blob_read_mb_piece’:
    oci8.c:1847: warning: format ‘%lu’ expects type ‘long unsigned int’, but argument 6 has type ‘ub4’
    Running Mkbootstrap for DBD::Oracle ()
    chmod 644 Oracle.bs
    rm -f blib/arch/auto/DBD/Oracle/Oracle.so
    gcc  -shared -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic Oracle.o dbdimp.o oci8.o -L/u01/oracle/lib/ -L/u01/oracle/rdbms/lib/   -lclntsh   `cat /u01/oracle/lib/sysliblist` -ldl -lm  -lpthread -o blib/arch/auto/DBD/Oracle/Oracle.so      
                    
    
    chmod 755 blib/arch/auto/DBD/Oracle/Oracle.so
    cp Oracle.bs blib/arch/auto/DBD/Oracle/Oracle.bs
    chmod 644 blib/arch/auto/DBD/Oracle/Oracle.bs
    Manifying blib/man3/DBD::Oracle::Troubleshooting.3pm
    Manifying blib/man3/DBD::Oracle::Troubleshooting::Cygwin.3pm
    Manifying blib/man3/DBD::Oracle.3pm
    Manifying blib/man3/DBD::Oracle::Troubleshooting::Sun.3pm
    Manifying blib/man3/DBD::Oracle::Troubleshooting::Hpux.3pm
    Manifying blib/man3/DBD::Oracle::Troubleshooting::Macos.3pm
    Manifying blib/man3/DBD::Oracle::Troubleshooting::Vms.3pm
    Manifying blib/man3/DBD::Oracle::Object.3pm
    Manifying blib/man3/DBD::Oracle::Troubleshooting::Aix.3pm
    Manifying blib/man3/DBD::Oracle::Troubleshooting::Linux.3pm
    Manifying blib/man3/DBD::Oracle::Troubleshooting::Win64.3pm
    Manifying blib/man3/DBD::Oracle::GetInfo.3pm
    Manifying blib/man3/DBD::Oracle::Troubleshooting::Win32.3pm
    make
    [root@arcerzhang DBD-Oracle-1.64]# make test
    PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
    t/000-report-versions-tiny.t .. #
    #
    # Generated by Dist::Zilla::Plugin::ReportVersions::Tiny v1.08
    # perl: 5.010001 (wanted 5.006) on linux from /usr/bin/perl
    #
    # Carp                                          => 1.11       (want any version)
    # Config                                        => <undef>    (want any version)
    # DBI                                           => 1.627      (want 1.51)
    # Data::Dumper                                  => 2.124      (want any version)
    # Devel::Peek                                   => 1.04       (want any version)
    # DynaLoader                                    => 1.10       (want any version)
    # Encode                                        => 2.35       (want any version)
    # Exporter                                      => 5.63       (want any version)
    # ExtUtils::MakeMaker                           => 6.55_02    (want 6.30)
    # Math::BigInt                                  => 1.89       (want any version)
    # Test::More                                    => 0.92       (want 0.88)
    # Thread::Semaphore                             => 2.09       (want any version)
    # strict                                        => 1.04       (want any version)
    # utf8                                          => 1.07       (want any version)
    # vars                                          => 1.01       (want any version)
    # version                                       => 0.77       (want 0.9901)
    # warnings                                      => 1.06       (want any version)
    #
    # Thanks for using my code.  I hope it works for you.
    # If not, please try and include this output in the bug report.
    # That will help me reproduce the issue and solve your problem.
    #
    t/000-report-versions-tiny.t .. ok
    t/00versions.t ................ # OCI client library version: 11.2.0.1
    t/00versions.t ................ 1/2 # database version: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
    t/00versions.t ................ ok
    t/01base.t .................... ok
    t/10general.t ................. ok
    t/12impdata.t ................. ok
    t/14threads.t ................. ok
    t/15nls.t ..................... ok
    t/20select.t .................. ok
    t/21nchar.t ................... ok
    t/22nchar_al32utf8.t .......... ok
    t/22nchar_utf8.t .............. ok
    t/23wide_db.t ................. ok
    t/23wide_db_8bit.t ............ ok
    t/23wide_db_al32utf8.t ........ ok
    t/24implicit_utf8.t ........... ok
    t/25plsql.t ................... ok
    t/26exe_array.t ............... ok
    t/28array_bind.t .............. ok
    t/30long.t .................... ok
    t/31lob.t ..................... 1/12 DBI::db=HASH(0x1a292f0)->disconnect invalidates 1 active statement handle (either destroy statement handles or call finish on them before disconnecting) at t/31lob.t line 216.
    t/31lob.t ..................... ok
    t/31lob_extended.t ............ ok
    t/32xmltype.t ................. ok
    t/34pres_lobs.t ............... ok
    t/36lob_leak.t ................ ok
    t/38taf.t ..................... ok
    t/39attr.t .................... # Oracle version: 11.2.0.1.0
    # client version: 11.2.0.1
    t/39attr.t .................... ok
    t/40ph_type.t ................. ok
    t/50cursor.t .................. Can't determine open_cursors from v$parameter, so using default
    t/50cursor.t .................. ok
    t/51scroll.t .................. ok
    t/55nested.t .................. ok
    t/56embbeded.t ................ ok
    t/58object.t .................. ok
    t/60reauth.t .................. skipped: ORACLE_USERID_2 not defined.
    t/70meta.t .................... ok
    t/80ora_charset.t ............. ok
    t/rt13865.t ................... ok
    t/rt74753-utf8-encoded.t ...... ok
    All tests successful.
    
    Test Summary Report
    -------------------
    t/31lob.t                   (Wstat: 0 Tests: 12 Failed: 0)
      TODO passed:   9-11
    Files=37, Tests=1858, 24 wallclock secs ( 0.31 usr  0.12 sys +  3.28 cusr  1.57 csys =  5.28 CPU)
    Result: PASS
    make test
    [root@arcerzhang DBD-Oracle-1.64]# make install
    Files found in blib/arch: installing files in blib/lib into architecture dependent library tree
    Installing /usr/local/lib64/perl5/auto/DBD/Oracle/ocitrace.h
    Installing /usr/local/lib64/perl5/auto/DBD/Oracle/Oracle.so
    Installing /usr/local/lib64/perl5/auto/DBD/Oracle/Oracle.h
    Installing /usr/local/lib64/perl5/auto/DBD/Oracle/mk.pm
    Installing /usr/local/lib64/perl5/auto/DBD/Oracle/Oracle.bs
    Installing /usr/local/lib64/perl5/auto/DBD/Oracle/dbdimp.h
    Installing /usr/local/lib64/perl5/DBD/Oracle.pm
    Installing /usr/local/lib64/perl5/DBD/Oracle/Object.pm
    Installing /usr/local/lib64/perl5/DBD/Oracle/Troubleshooting.pod
    Installing /usr/local/lib64/perl5/DBD/Oracle/GetInfo.pm
    Installing /usr/local/lib64/perl5/DBD/Oracle/Troubleshooting/Win32.pod
    Installing /usr/local/lib64/perl5/DBD/Oracle/Troubleshooting/Vms.pod
    Installing /usr/local/lib64/perl5/DBD/Oracle/Troubleshooting/Linux.pod
    Installing /usr/local/lib64/perl5/DBD/Oracle/Troubleshooting/Win64.pod
    Installing /usr/local/lib64/perl5/DBD/Oracle/Troubleshooting/Aix.pod
    Installing /usr/local/lib64/perl5/DBD/Oracle/Troubleshooting/Macos.pod
    Installing /usr/local/lib64/perl5/DBD/Oracle/Troubleshooting/Sun.pod
    Installing /usr/local/lib64/perl5/DBD/Oracle/Troubleshooting/Hpux.pod
    Installing /usr/local/lib64/perl5/DBD/Oracle/Troubleshooting/Cygwin.pod
    Installing /usr/local/share/man/man3/DBD::Oracle::GetInfo.3pm
    Installing /usr/local/share/man/man3/DBD::Oracle::Troubleshooting::Linux.3pm
    Installing /usr/local/share/man/man3/DBD::Oracle::Troubleshooting::Win64.3pm
    Installing /usr/local/share/man/man3/DBD::Oracle::Troubleshooting::Aix.3pm
    Installing /usr/local/share/man/man3/DBD::Oracle.3pm
    Installing /usr/local/share/man/man3/DBD::Oracle::Troubleshooting::Sun.3pm
    Installing /usr/local/share/man/man3/DBD::Oracle::Troubleshooting::Cygwin.3pm
    Installing /usr/local/share/man/man3/DBD::Oracle::Troubleshooting::Vms.3pm
    Installing /usr/local/share/man/man3/DBD::Oracle::Troubleshooting::Win32.3pm
    Installing /usr/local/share/man/man3/DBD::Oracle::Object.3pm
    Installing /usr/local/share/man/man3/DBD::Oracle::Troubleshooting.3pm
    Installing /usr/local/share/man/man3/DBD::Oracle::Troubleshooting::Hpux.3pm
    Installing /usr/local/share/man/man3/DBD::Oracle::Troubleshooting::Macos.3pm
    Appending installation info to /usr/lib64/perl5/perllocal.pod
    make install

    5、验证安装

    [root@arcerzhang scripts]# /root/scripts/chk2.pl 
    DBD::Oracle  -- 1.64
    DBI          -- 1.627
    Perl         -- 5.10.1
    验证安装modules
  • 相关阅读:
    书本第十三章课后习题4、5、6
    软件工程一班第五小组知识树系统-软件测试计划
    第八周作业
    第七周作业——用面向对象方法分析研究书中习题2第3题中描述的机票预订系统,试建立它的对象模型、动态模型和功能模型。
    第六周作业——建立订货系统的用例模型
    第五周作业——用状态转换图描绘复印机的行为
    第四周作业——在你的实际项目旅游网站中,网页主页面主要有哪些模块?
    第三周作业—— 在软件开发的早期阶段为什么要进行可行性研究?应该从哪些方面研究目标系统的可行性?
    第二周作业——面向过程(或者叫结构化)分析方法与面向对象分析方法到底区别在哪里?请根据自己的理解简明扼要的回答。
    有学生提到,在大学选课的时候,可以写一个“刷课机”的程序,利用学校选课系统的弱点或漏洞,帮助某些人选到某些课程。或者帮助用户刷购票网站,先买到火车票。这些软件合法么?符合道德规范么?是在“软件工程”的研究范围么? 请大家讨论。
  • 原文地址:https://www.cnblogs.com/arcer/p/3150796.html
Copyright © 2020-2023  润新知