无法为模块XML :: LibXML :: Common加载'/usr/lib/perl5/vendor_perl/5.8/msys/auto/XML/LibXML/Common/Common.dll':dlopen:Win32错误126

时间:2012-10-08 10:00:11

标签: xml perl xml-parsing perl-module

我遇到了这个错误:

Can't load '/usr/lib/perl5/vendor_perl/5.8/msys/auto/XML/LibXML/Common/Common.dll' for module XML::LibXML::Common: dlopen: Win32 error 126 at /usr/lib/perl5/5.8
/msys/DynaLoader.pm line 230.
 at /usr/lib/perl5/vendor_perl/5.8/msys/XML/LibXML.pm line 12
Compilation failed in require at /usr/lib/perl5/vendor_perl/5.8/msys/XML/LibXML.pm line 12.
BEGIN failed--compilation aborted at /usr/lib/perl5/vendor_perl/5.8/msys/XML/LibXML.pm line 12.

Compilation failed in require at script.pl line 5.    
BEGIN failed--compilation aborted at script.pl line 5.

加载使用XML::Libxml的perl脚本。

上周工作得很好,所以我确定我没有任何语法错误或路径错误。

我无法阅读错误也无法理解......

这是我的脚本,非常简单:

    #!/usr/bin/perl
    use utf8; 
    use strict;
    use warnings;
    use XML::LibXML;
    require "D:/Projets/Maroc Scada/Rabat 41 - Images T200i-DRR-F200C/script_PI/addresses.pl";

    my $Filepath = "D:/Projets/Maroc Scada/Rabat 41 - Images T200i-DRR-F200C/script_PI/RTUS_originaux";     # Must contain a "treated" subdirectory to store results
    my $parser;         # LibXML object used to read the text file .xml
    my $xmldoc;         # XML document parsed, ready to use with libxml API
    my $i = 0;          # treated elements per file
    my $j = 0;          # treated files
    my $RTUName;        # Name of the current RTU
    my $RTUType;        # Type of the RTU. matching the key in %address hash table in addresses.pl
    my $MeasureName;    # Current Measure Name (for printing in console)
    my $Parameters;     # parameters to apply to on the node. Typically a hash containing key->values of the parameters to be updated as { "MonitorTcAddress" => "11", ... }
    my $v = 0;          # 1 for more debug information. If 0, only errors and message "end of program"

    # Get the files in the given directory and loop on all xml files exported from PowerCC
    print "Beginning of program...\n";
    opendir(DIR, $Filepath);
    my @FILES= readdir(DIR); 
    foreach my $File (@FILES) {

        if ($File =~ m/.xml/) {   #  m/.xml$/
            print "Opening ".$File."\n" if $v;
            $j++;
            $parser = XML::LibXML->new();
            $xmldoc = $parser->parse_file($Filepath."/".$File);


            #  Loop on all nodes in xml file to place the default addresses (IOA) 
            #  and the types of the measurements in the RTYType defined in 
            #  the hash in address.pl

            # Loop on all RTUs
            for my $rtu ($xmldoc->findnodes('/XDF/Instances/Parent/CfeSubRemoteTerminalUnit')) {
                $RTUName = $rtu->getAttribute("Name");
                $RTUType = $rtu->getAttribute("Description");
                if (length($RTUType) < 2) { print "[ERROR 002] : Type of RTU is not defined for RTU=".$RTUName."   Type=".$RTUType."\n"; }
                print "RTUName=".$RTUName . ", Type=". $RTUType. "\n"  if $v;

                # Chosing IEC 101 and address structure 24 bits
                $rtu->setAttribute("TeleControlProtocolType", "1");
                $rtu->setAttribute("DataPointAddressStructure", "4");


                # Looking for all Analog measurements
                for my $Measure ($rtu->findnodes('CfeTelemeteredAnalog')) { 
                    $MeasureName = $Measure->getAttribute("Name");
                    $Parameters = getAddress($MeasureName, $RTUType);

                    if ($$Parameters{"RemoveFromPI"}) {             # Special. Point is in PI but doesn't exist in reality -> removing from XML.
                        print "[SPECIAL 005] : Removing node ".$MeasureName." from XML file.\n" if $v;
                        $Measure->unbindNode();
                    }
                    else {
                        # Overwrite all parameters in the Hash $adresses on the attributes of the current node.
                        foreach my $Param (keys %$Parameters)  {
                            $Measure->setAttribute( $Param, $$Parameters{$Param} );
                            print " ".$MeasureName." :      ".$Param." =>   ".$$Parameters{$Param}."\n" if $v;
                        }
                        $i++;
                    }
                } # Analog Iteration


                # Looking for all Digital Status. Same structure. Duplicated code iterating on digital nodes
                for my $Measure ($rtu->findnodes('CfeTelemeteredDigital')) { 
                    $MeasureName = $Measure->getAttribute("Name");
                    $Parameters = getAddress($MeasureName, $RTUType);

                    if ($$Parameters{"RemoveFromPI"}) {             # Special. Point is in PI but doesn't exist in reality -> removing from XML.
                        print "[SPECIAL 006] : Removing node ".$MeasureName." from XML file.\n" if $v;
                        $Measure->unbindNode();
                    }
                    else {
                        # Overwrite all parameters in the Hash $adresses on the attributes of the current node.
                        foreach my $Param (keys %$Parameters)  {
                            $Measure->setAttribute( $Param, $$Parameters{$Param} );
                            print " ".$MeasureName." :      ".$Param." =>   ".$$Parameters{$Param}."\n"   if $v;
                        }
                        $i++;
                    }
                } # Digital iteration


            } # RTU iteration



            # write the xml tree to a text file
            open (MYFILE, '>'.$Filepath.'/treated/'.$File);
            print MYFILE $xmldoc->toString(1);
            close (MYFILE); 
            print "Closing ".$File.". Treated elements = ".$i."\n"  if $v;
        } # if . or ..
    } # loop on files in directory

    print "End of Program. ".$j." XML files treated, ".$i." elements.\n";

1 个答案:

答案 0 :(得分:1)

基本上你的Perl库已经损坏,你应该向负责维护它的人报告。如果您可以自己完成此操作,则只需重新安装XML::LibXML

即可