これは私の以前の質問の拡張です: pass a hash object from one perl script to another using system . @Sobriqueが私の質問に答えました。
ここで、上記の質問と同じ方法でハッシュ オブジェクトを別の perl スクリプトに渡すことができるかどうかを知りたいのですが、bsub
.
ラッパースクリプト: script1.pl
use strict;
use warnings;
use Storable qw ( freeze );
use MIME::Base64;
my %test_hash = (
"fish" => "paste",
"apples" => "pears"
);
my $frozen = encode_base64 freeze( \%test_hash );
my ${string} = 'sample1';
# instead of just using system like this
# system("perl", "some_other_script.pl", $frozen);
# I want to use something like this:
system('bsub','-J',${string},'-o','${string}.out','-e','${string}.err','perl','some_other_script.pl',$frozen);
some_other_script.pl
use strict;
use warnings;
use Storable qw ( thaw );
use Data::Dumper;
use MIME::Base64;
# should read the imported hash correctly and print it out
my ($imported_scalar) = @ARGV;
print $imported_scalar;
my %param = %{ thaw (decode_base64 $imported_scalar ) };
print $param{'fish'};
print "\n";
どうすればこれを達成できますか?どんな助けでも大歓迎です。
ありがとう!