Many Perl modules need other modules to work. All modules that were identified to be needed by a certain Perl module bundled with WA2L/edrc are also included into the package.
To start a Perl script that uses a bundled Perl module from a recovery script, set the Perl library path (@INC) using the 'eval `perlenv`' command in the recovery script and then call the perl interpreter:
        #!/bin/ksh
        #
        # 1:ascript - A Recovery Script  
        #
        # [00] 08.02.2009 CWa   Initial Version
        #
        #
        test "$DEBUG" = True && set -x
        :
        :
        eval `perlenv`
        perl ./perlscript
        :
An other possibility is to create an _env file (using the env edrc command) with the content:
        #
        # _env - Environment settings for commands in /apps/eg
        #
        # [00] 18.03.2009 CWa   Initial Version
        #
        #
        test "$DEBUG" = True && set -x
        eval `perlenv`
        :
and use the bundled Perl module using the
' use module; '
clause:
        #!/usr/bin/env perl
        #
        # perlscript - Perl script using bundled DBI module
        #
        # [00] 18.03.2009 CWa   Initial Version
        #
        :
        :
        use DBI;
        :
With this 2nd method it is also possible to write
recovery scripts in Perl that use the bundled Perl modules.
Note the use of '#!/usr/bin/env perl' in the magic key to start the Perl script. This ensures that the perl interpreter is found on the system, even when it is not installed in the default location you will normally specify.
If you experience missing modules when using a WA2L/edrc Perl command (watch for PSCR in compatibility(1)) or in an own Perl script using bundled Perl modules you might be forced to compile it for your system.
To do so:
host-001# ~edrc/bin/shell
[ /root ] [ root@host-001 ][*eshell*/bash]: cdsrc; cd perlmodules [ /opt/edrc/src/perlmodules ] [ root@host-001 ][*eshell*/bash]:
[ /opt/edrc/src/perlmodules ] [ root@host-001 ][*eshell*/bash]: make list # # LIST MODULES # : Compress::Compress-Raw-Zlib Compress::Compress-Zlib LWP::LWP-UserAgent JSON::JSON URI::URI MediaWiki::MediaWiki-API File::File-Tail CMS::CMS-MediaWiki :
Identify the module(s) that has been reported as missing on the output list. Often a whole chain of modules are missing, where the above sequence gives help on the compile/install order.
[ /opt/edrc/src/perlmodules ] [ root@host-001 ][*eshell*/bash]: [ /opt/edrc/src/perlmodules ] [ root@host-001 ][*eshell*/bash]: make help [ /opt/edrc/src/perlmodules ] [ root@host-001 ][*eshell*/bash]: make build
To build a subset of the whole module list defined in the ALL variable in the Makefile, add the module to the TST variable and invoke:
[ /opt/edrc/src/perlmodules ] [ root@host-001 ][*eshell*/bash]: make buildtst
[ /opt/edrc/src/perlmodules ] [ root@host-001 ][*eshell*/bash]: make install
[ /opt/edrc/src/perlmodules ] [ root@host-001 ][*eshell*/bash]: make clean
  [ /opt/edrc/src/perlmodules ]
  [ root@host-001 ][*eshell*/bash]: pack -d ~edrc/var/sw -a edrc_UPDATE -p `apprevision` 
  pack - create application package, by Chr. Walther
    
  create package of application in '/opt/edrc' ...
      application information ...
          APPLICATION .......... : edrc_UPDATE 
          APPLICATION_PREFIX ... : edrc_WA2L 
          APPLICATION_NAME ..... : WA2L/edrc 
          APPLICATION_RELEASE .. : 1.5.46
          DESCRIPTION .......... : WA2L/edrc without recovery script-, config-, security-files, notes (to deploy WA2L/edrc updates in different environments) 
      done.
      package information ...
          format ............... : shar
          type ................. : PATCH (to version 1.5.46)
          file ................. : host-001:/opt/edrc/var/sw/edrc_WA2L-1.5.46-201408231741-PATCH-1.5.46.cpio.gz
      done.
      write sadm file ...(/opt/edrc/var/pack/sadm/edrc_WA2L-1.5.46-201408231741-PATCH-1.5.46.gz)... done.
      evaluate files to be packed ... (729 files)... done.
      evaluate properties of files to be packed ... done.
      pack files to package file ... (12917 kB)... done.
  done.
  [ /opt/edrc/src/perlmodules ]
  [ root@host-001 ][*eshell*/bash]: sat
  sat@host-001> edrcupgrade
  (s)tart (d)ownload only (i)nstall only (c)ancel  [c] :i
  DEPLOY AND INSTALL AN WA2L/edrc PATCH
  patchfile basedir [/opt/edrc/var/sw]:
  list downloaded patch files? <ync>  [y] :y
  AVAILABLE EDRC PATCH files:
    FROM    TO      FILENAME                                            
    ------  ------  --------------------------------------------------  
    1.5.46  1.5.46  edrc_WA2L-1.5.46-201408231741-PATCH-1.5.46.cpio.gz  
    (1)
  patchfile to install : edrc_WA2L-1.5.46-201408231741-PATCH-1.5.46.cpio.gz  
  :
You can also install the generated patch more manually first distributing the patch file using filedist(1) and then installing it with the patchinstall(1m) command on all systems using the rcmd(1) command.
See also perl_wrapper(1) for examples of integrating Perl scripts into WA2L/edrc.
This is free software; see edrc/doc/COPYING for copying conditions. There is ABSOLUTELY NO WARRANTY; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.