Showing posts with label Perl Debugging. Show all posts
Showing posts with label Perl Debugging. Show all posts

Wednesday, 25 January 2012

Active perl installation on Windows and Unix

AIX
  • GNU tar is required to extract the ActivePerl tarball into the filesystem. A precompiled version of GNU tar for AIX 5L can be found here:
        http://www-03.ibm.com/systems/p/os/aix/linux/toolbox/download.html
    You can also get the source package for GNU tar from:
        http://www.gnu.org/
  • The reloc_perl script does not correctly update the perl-dynamic executable. The workaround is to install directly from the tarball into the new location.

Solaris

  • GNU tar is required to extract the ActivePerl tarball into the filesystem. A precompiled version of GNU tar for Solaris is available from:
        http://www.sunfreeware.com/
    You can also get the source package for GNU tar from:
        http://www.gnu.org/

Mac OS X

  • Perl library paths, and thus PPM Areas, defined in the shell by the PERL5LIB environment variable are not available to PPM when it is launched by clicking the PPM icon in OS X. To to make this variable available in the OS X GUI, add an entry similar to the following to ~/.MacOSX/environment.plist:
     <key>PERL5LIB</key>
     <string>/path/to/perl/lib</string>
  • Running sudo ppm or sudo ppm gui does not start up the GUI with root privileges. Use ppm as a command line tool with sudo.

Windows

  • The fork() emulation has known limitations. See the perlfork manpage for a detailed summary. In particular, fork() emulation will not work correctly with extensions that are either not thread-safe, or maintain internal state that cannot be cloned in the pseudo-child process. This caveat currently applies to extensions such as Tk and Storable.
  • It seems that some people are having problems with the ActivePerl MSI installer. The first thing to note is that you CANNOT install ActivePerl 5.14 over an older version of ActivePerl based on 5.12, 5.10, 5.8, 5.6 or 5.005, such as build 1204 or any other 1200, 1000, 800, 600 or 500 series build. We have determined that some of these problems are due to other installations of Perl that may be pointed at by something in the environment.
    The sure-fire solution is to make absolutely certain that no other installations of Perl are on the target machine. Realizing that this is not always possible, you can follow these steps to ensure the other installations will not interfere.
    1. Stop the "Windows Installer" service. This can be accomplished from the command prompt using the following command:
          c:\> net stop "Windows Installer"
    2. Temporarily remove or rename PERLLIB and PERL5LIB environment variables in the system environment.
    3. Temporarily remove or rename the following registry values:
          [\\HKEY_LOCAL_MACHINE\Software\Perl] lib = <directory> (REG_SV)
          [\\HKEY_LOCAL_MACHINE\Software\Perl] sitelib = <directory> (REG_SV)
          [\\HKEY_LOCAL_MACHINE\Software\Perl] lib-<PerlVersion> = <directory> (REG_SV)
          [\\HKEY_LOCAL_MACHINE\Software\Perl] sitelib-<PerlVersion> = <directory>(REG_SV)
    4. Proceed with the installation.
    Once the installation has completed successfully, the above actions may be undone although restoring the environment variables or the registry values may interfere with the proper operation of your new ActivePerl installation. In order to perform all of the above steps, you will need to have Administrative privileges on the target machine. If you do not have the required privileges you should contact you Administrator.

Further Information

The Perl distribution comes with extensive documentation. On Unix platforms, all the standard documentation is installed as man pages under the Perl install location. The location of the man pages may need to be added to the MANPATH environment variable in order to access them. For example, in the C shell:
    % setenv MANPATH /opt/ActivePerl-5.14/man:$MANPATH
The documentation is installed in HTML format on all platforms. If ActivePerl was installed in /opt/ActivePerl-5.14 then the HTML documentation would be located in /opt/ActivePerl-5.14/html.
On Windows, the standard documentation along with Windows-specific Perl documentation is installed in HTML format, and is accessible from the "Start" menu.
Updated versions of the HTML documentation will always be available at the ActiveState website:
    http://www.activestate.com/ActivePerl

Monday, 26 December 2011

Install perl module from CPAN

To install DBI module from CPAN site directly do this:

perl -MCPAN -e 'install Bundle::DBD::DB2 '

For more installation methods look into:

http://savage.net.au/Perl-modules/html/installing-a-module.html 

Perl DBI and DB2 modules installation on AIX 6.1

My AIX6.1 natively didnot have c compiler.So, I have downloaded xlc compiler to compile and install perl DBI and DB2 modules.
Also, DB2 module installation using perl5.8.8  failed with Usage: Cwd::fastcwd()  error.

# Here are the debugging steps I have performed to install DB2 module using perl 5.14.2 #
AIX Tools for linux:
http://www-03.ibm.com/systems/power/software/aix/linux/toolbox/ezinstall.html 

Install xlc_r compiler as follows:
http://www-01.ibm.com/software/awdtools/xlcpp/aix/   - xlcpp  compiler (aix c/c++ compiler)
xlcpp installation guide:https://www-304.ibm.com/support/docview.wss?uid=swg27017988&aid=1

Command to install:
installp -aXYgd ./xlcpp/usr/sys/inst.images -e /tmp/install.log all

export PATH=$PATH:/usr/vac/bin:/usr/vacpp/bin


## Install perl 5.14.2 in threaded 32-bit mode ##
####################################################
 rm config.sh
    ./Configure \
    -d \
    -Dcc=cc_r \
    -Duseshrplib \
    -Dusethreads \
    -Dprefix=/usr/opt/perl5_32
####################################################

Using [:upper:] and [:lower:] to convert case.
./Configure[3141]: cc_r:  not found.
You need to find a working C compiler.
Either (purchase and) install the C compiler supplied by your OS vendor,
or for a free C compiler try
http://gcc.gnu.org/
I cannot continue any further, aborting.
####################################################
Trouble shooting:
export PATH=$PATH:/usr/vac/bin  (for xlc_r compiler in PATH)

use -Dcc=xlc_r (xlc_r installed manually)
####################################################

####################################################
./Configure -d -Dcc=xlc_r -Duseshrplib -Dusethreads -Dprefix=/usr/opt/perl5_32

Looking for extensions...
A number of extensions are supplied with perl5.  You may choose to
compile these extensions for dynamic loading (the default), compile
them into the perl5 executable (static loading), or not include
them at all.  Answer "none" to include no extensions.
Note that DynaLoader is always built and need not be mentioned here.

perl5.14 dynamically loaded modules :
What extensions do you wish to load dynamically?
[B Compress/Raw/Bzip2 Compress/Raw/Zlib Cwd Data/Dumper Devel/DProf Devel/PPPort Devel/Peek Digest/MD5 Digest/SHA

Encode Fcntl File/Glob Filter/Util/Call Hash/Util Hash/Util/FieldHash I18N/Langinfo IO IPC/SysV List/Util
MIME/Base64 Math/BigInt/FastCalc NDBM_File ODBM_File Opcode POSIX PerlIO/encoding PerlIO/scalar PerlIO/via SDBM_File
Socket Storable Sys/Hostname Sys/Syslog Text/Soundex Tie/Hash/NamedCapture Time/HiRes Time/Piece Unicode/Collate
Unicode/Normalize XS/APItest XS/Typemap attributes mro re threads threads/shared]
What extensions do you wish to load statically? [none]

Stripping down cppstdin path name
End of configuration questions.

Stripping down executable paths...
Creating config.sh...
If you'd like to make any changes to the config.sh file before I begin
to configure things, do it as a shell escape now (e.g. !vi config.sh).


make
make test
make install


/usr/opt/perl5_32/lib/5.14.2/aix-thread-multi/Config.pm   file now contains  xlc_r and proper archlib path to perl
5.14.2.
####################################################

####################################################
bash-3.2# export PATH=/usr/opt/perl5_32/bin/:$PATH
echo $PATH
/usr/opt/perl5_32/bin/:/usr/bin:/etc:/usr/sbin:/usr/ucb:/usr/bin/X11:/sbin:/usr/java5/jre/bin:/usr/java5/bin:/usr/va

c/bin:/home/db2inst1/sqllib/bin:/home/db2inst1/sqllib/adm:/home/db2inst1/sqllib/misc
Install Perl DBI using /usr/opt/perl5_32/bin/perl Makefile.PL
make
make test
make install

Before Installing DBD::DB2 module:
do : 
bash-3.2# source /home/db2inst2/sqllib/db2profile
bash-3.2# export PATH=/usr/opt/perl5_32/bin/:$PATH  (inlcude perl5.14.2 binary first in the PATH)
bash-3.2# export DB2_HOME=/home/db2inst2/sqllib


Note that $DB2_HOME/include should contain db2 sqlclient related header files.

Now do:
bash-3.2# /usr/opt/perl5_32/bin/perl Makefile.PL

Configuring DBD::DB2...
Remember to actually read the README and CAVEATS files!

Using DB2 in "/home/db2inst2/sqllib"
System: perl5.014002 DBI1.616 aix app4 1 6 00f6fa664c00  aix-thread-multi dl_aix.xs
Compiler: xlc_r -q32 -O -D_ALL_SOURCE -D_ANSI_C_SOURCE -D_POSIX_SOURCE -qmaxmem=-1 -qnoansialias -DUSE_NATIVE_DLOPEN

-DNEED_PTHREAD_INIT -qlanglvl=extended -q32 -D_LARGE_FILES -qlonglong
Includes:  -I"/home/db2inst2/sqllib/include" -I"/usr/opt/perl5_32/lib/site_perl/5.14.2/aix-thread-multi/auto/DBI"

-I"/usr/opt/perl5_32/lib/5.14.2/aix-thread-multi/auto/DBI"
-I"/usr/opt/perl5_32/lib/site_perl/5.14.2/aix-thread-multi/auto/DBI"
Libraries: -L/home/db2inst2/sqllib/lib64 -ldb2

Checking if your kit is complete...
Looks good
Writing Makefile for DBD::DB2::Constants
Writing MYMETA.yml
Writing Makefile for DBD::DB2
Writing MYMETA.yml


make:
bash-3.2# make
bash-3.2# make test
bash-3.2# make install
Files found in blib/arch: installing files in blib/lib into architecture dependent library tree
Installing /usr/opt/perl5_32/lib/site_perl/5.14.2/aix-thread-multi/auto/DBD/DB2/DB2.bs
Installing /usr/opt/perl5_32/lib/site_perl/5.14.2/aix-thread-multi/auto/DBD/DB2/DB2.so
Installing /usr/opt/perl5_32/lib/site_perl/5.14.2/aix-thread-multi/auto/DBD/DB2/Constants/Constants.bs
Installing /usr/opt/perl5_32/lib/site_perl/5.14.2/aix-thread-multi/auto/DBD/DB2/Constants/Constants.so
Installing /usr/opt/perl5_32/lib/site_perl/5.14.2/aix-thread-multi/Bundle/DBD/DB2.pm
Installing /usr/opt/perl5_32/lib/site_perl/5.14.2/aix-thread-multi/DBD/DB2.pm
Installing /usr/opt/perl5_32/lib/site_perl/5.14.2/aix-thread-multi/DBD/DB2.pod
Installing /usr/opt/perl5_32/lib/site_perl/5.14.2/aix-thread-multi/DBD/DB2/Constants.pm
Installing /usr/opt/perl5_32/lib/site_perl/5.14.2/aix-thread-multi/auto/DBD/DB2/Constants/autosplit.ix
Installing /usr/opt/perl5_32/man/man3/Bundle::DBD::DB2.3
Installing /usr/opt/perl5_32/man/man3/DBD::DB2.3
Appending installation info to /usr/opt/perl5_32/lib/5.14.2/aix-thread-multi/perllocal.pod

####################################################
Now, DB2 module is ready for connecting perl scripts to db2 database.
Tweets by @sriramperumalla