Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/powershell/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Perl:无法加载模块_Perl_Powershell - Fatal编程技术网

Perl:无法加载模块

Perl:无法加载模块,perl,powershell,Perl,Powershell,我正在使用此PowerShell::Cmdlet模块从perl脚本运行PowerShell命令,但我一直收到此错误,即使我已将模块放置在lib文件夹中 无法通过 我相信您对getchilditem(图像而不是路径)使用了错误的参数,并且正如@ikegami所提到的,应该将模块更改为PowerShell。您可以尝试以下操作: use strict; use warnings; use PowerShell; my $res ; my $command = PowerShell ->new

我正在使用此
PowerShell::Cmdlet
模块从perl脚本运行PowerShell命令,但我一直收到此错误,即使我已将模块放置在
lib
文件夹中

无法通过


我相信您对getchilditem(图像而不是路径)使用了错误的参数,并且正如@ikegami所提到的,应该将模块更改为PowerShell。您可以尝试以下操作:

use strict;
use warnings;
use PowerShell;

my $res ;

my $command = PowerShell
->new('Get-ChildItem', [Path => '\\\\10.0.0.1\\testshare\\'],[include => '*.txt'],[recurse => ''])
->command();
 my $result = `$command`;

print($result)

这不应该是
使用PowerShell?我在C:/Perl64/lib/PowerShell.pm第32行发现此错误
全局符号“$logger”需要显式的包名(您是否忘记声明“my$logger”?)。
另一个错误是
无法在
lib
文件夹中找到PowerShell.pm
,但是我已经把
pl
文件放在
lib
folder@kewin您使用的是哪种perl实现(活动状态还是草莓)?我使用的是活动状态state@kewin在运行cpan PowerShell之后。您可以检查c:\perl64\lib中是否有powershell.pm,否则您可能需要从c:\perl64\cpan\build\powershell-1.00-\lib复制powershell.pm和powershell文件夹。上面的代码片段在activestate中运行良好,因此我猜这是一个与模块相关的问题
use strict;
use warnings;
use PowerShell;

my $res ;

my $command = PowerShell
->new('Get-ChildItem', [Path => '\\\\10.0.0.1\\testshare\\'],[include => '*.txt'],[recurse => ''])
->command();
 my $result = `$command`;

print($result)