首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Perl命令未作为脚本的一部分执行

Perl命令未作为脚本的一部分执行
EN

Stack Overflow用户
提问于 2015-08-25 06:24:26
回答 1查看 80关注 0票数 0

我有一个Perl脚本wrapper.pl,其中有一段代码,如下所示:

代码语言:javascript
复制
if (-e "$run_dir/fd3d/VrtMsgBus.txt") {

    print "VRTMSGBUS: non scalablity mode VrtMsgBus.txt exists\n";  


    $conf->{'script_list'}{'vrt_scalability'} = {
        'cmd'       => "perl $script_dir/hevc_enc/pak_rtl/vrt_scalability.pl $run_dir $hevc_fd3d_dir $script_dir",
        'dumpdir'   => $dumpdir,
        'units'     => [qw(hwm hle vne hvd hsse hit hpo hfq hft hpr hrs hlc hmc hpp hed vnc htq hsao hmx hlf)],
        'requires'  => [qw(vrtmsgbus mv_vrtmsgbus mv_vrtmsgbus_org mv_vrtmsgbus_no_scalability)],
    };
}
else {

    print "VRTMSGBUS: scalablity mode, VrtMsgBus.txt doesnt exist\n";

    $conf->{'script_list'}{'vrt_scalability_2'} = {
        'cmd'       => "perl $script_dir/hevc_enc/pak_rtl/vrt_scalability.pl $run_dir $hevc_fd3d_dir $script_dir",
        'dumpdir'   => $dumpdir,
        'units'     => [qw(hwm hle vne hvd hsse hit hpo hfq hft hpr hrs hlc hmc hpp hed vnc htq hsao hmx hlf)],
    };


}   

我正在尝试以代码中所示的方式针对不同的条件执行特定的脚本vrt_scalability.plvrt_scalability.p‘是一个单独的脚本,可以从命令行运行,但当我尝试使用此wrapper.pl执行它时,它会失败。如何调试这类代码?

此外,当我独立于wrapper.pl运行在此代码的cmd部分中调用的命令时,它们都可以正常工作。我能做错什么呢?

在此处执行脚本:

代码语言:javascript
复制
sub ExecScripts {

   foreach my $exec_script_name (keys %{$conf->{'exec_list'}})
    {

    $conf->{'exec_list'}{$exec_script_name}{'script_was_executed'} = 0;

}

foreach my $exec_script_name (keys %{$conf->{'exec_list'}})
{

    my $dependency_script = $conf->{'exec_list'}{$exec_script_name};
    if (exists $dependency_script->{'requires'})
    {
        foreach my $parent_script (@{$dependency_script->{'requires'}})
        {

            ExecDependencyScripts($conf, $parent_script);
        }
    }  
EN

回答 1

Stack Overflow用户

发布于 2015-08-25 20:02:10

您将填充$conf->{script_list},但稍后将使用$conf->{exec_list}

如何调试?我经常使用https://metacpan.org/pod/Data::Dumperhttps://metacpan.org/pod/Log::Log4perl::Tiny (不知羞耻的插件)的组合,并在代码中添加调试语句,以确保每个步骤都发生了什么。

例如,在本例中,我将在输入ExecScripts时添加整个$conf变量的打印输出。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/32192730

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档