in reply to How to include bash functions file in Perl?

You didn't specify what interface your script provides to allow other processes to access its functions. You're not even clear in which language your library uses. (bash or ksh?) Helping you use an unspecified interface is not really possible.

Update: Well, you could do

$ cat lib function greet() { echo 'Hello World!' } $ bash --rcfile lib -i -c greet Hello World! $ perl -e'system(bash => ( "--rcfile" => "lib", -i, -c => "greet" ))' Hello World!

Replies are listed 'Best First'.
Re^2: How to include bash functions file in Perl?
by aceroraptor (Initiate) on May 19, 2010 at 20:36 UTC

    Sorry, I am a forum novice. Thanks your example did the trick. I wanted to make use of existing functions in a bash script. The particular function renamed for backup purposes existing log files. Below is the corrected problem area:

    my $sysTestLib="$HOME/bin/test/library/libsystemtest.ksh"; # Systest +libraries my $libFunc; # Systest Libray function variable if (-e $RESULTS) { $libFunc="libHandleFileName -f $RESULTS"; # System Test Library +Function $renameRes = system(bash => ("--rcfile" => "$sysTestLib", -i, -c => + "$libFunc" ) ); }
      sub text_to_sh_lit { my ($s) = @_; $s =~ s/'/'\\''/g; return "'$s'"; } my $cmd = ( join ' ', map text_to_sh_lit($_), libHandleFileName => ( -f => $RESULTS, ) ); $renameRes = system( bash => ( "--rcfile" => $sysTestLib, -i, -c => $cmd, ) );