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)