标题:perl报错,请问大佬们该怎么解决呀
只看楼主
双鱼灵汐
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2022-10-19
 问题点数:0 回复次数:1 
perl报错,请问大佬们该怎么解决呀
Can't load 'C:\Users\Aurora\AppData\Local\Temp\par-4175726f7261\cache-e4b50c9567fa6a2839309a62779e4994304ae099\27469b66.xs.dll' for module XML::Parser::Expat: load_file:找不到指定的模块。 at D:/Download/perl/lib/DynaLoader.pm line 193.
  at D:/Download/perl/vendor/lib/PAR/Heavy.pm line 140.
Compilation failed in require at XML/Parser.pm line 18.
BEGIN failed--compilation aborted at XML/Parser.pm line 22.
Compilation failed in require at D:/Download/perl/vendor/lib/XML/SAX/Expat.pm line 11.
BEGIN failed--compilation aborted at D:/Download/perl/vendor/lib/XML/SAX/Expat.pm line 11.
Compilation failed in require at (eval 13) line 1.
XML::Simple called at script/getClinical.pl.cp line 25.
搜索更多相关主题的帖子: Compilation XML lib 报错 line 
2022-10-19 14:23
fall_bernana
Rank: 11Rank: 11Rank: 11Rank: 11
等 级:贵宾
威 望:17
帖 子:240
专家分:2086
注 册:2019-8-16
得分:0 
回复 楼主 双鱼灵汐
程序代码:
use strict;
use warnings;
use XML::Simple qw(:strict);
my $content="";
while (<DATA>) {
    chomp;
    $content=$content.$_
}
my $config = XMLin($content, KeyAttr => { server => 'name' }, ForceArray => [ 'server', 'address' ]);

use Data::Dumper;

 
print Dumper($config);

__DATA__
<config logdir="/var/log/foo/" debugfile="/tmp/foo.debug">
  <server name="sahara" osname="solaris" osversion="2.6">
    <address>10.0.0.101</address>
    <address>10.0.1.101</address>
  </server>
  <server name="gobi" osname="irix" osversion="6.5">
    <address>10.0.0.102</address>
  </server>
  <server name="kalahari" osname="linux" osversion="2.0.34">
    <address>10.0.0.103</address>
    <address>10.0.1.103</address>
  </server>
</config>


$VAR1 = {
          'debugfile' => '/tmp/foo.debug',
          'server' => {
                      'kalahari' => {
                                    'osversion' => '2.0.34',
                                    'osname' => 'linux',
                                    'address' => [
                                                 '10.0.0.103',
                                                 '10.0.1.103'
                                               ]
                                  },
                      'sahara' => {
                                  'osversion' => '2.6',
                                  'osname' => 'solaris',
                                  'address' => [
                                               '10.0.0.101',
                                               '10.0.1.101'
                                             ]
                                },
                      'gobi' => {
                                'osversion' => '6.5',
                                'osname' => 'irix',
                                'address' => [
                                             '10.0.0.102'
                                           ]
                              }
                    },
          'logdir' => '/var/log/foo/'
        };

我新安装的XML::Simple,没有问题,请帖有问题的代码。
2022-10-20 14:51



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-510378-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.069108 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved