Procécure de compilation et d'intégration du wrapper libxml2 pour Perl.
Si vous ne disposez pas du compilateur nmake sur votre poste la page http://johnbokma.com/perl/make-for-windows.html vous apportera une aide précieuse.
D:\dev\perl\XML-LibXML-Common-0.13>Makefile.PL LIBS="D:\libxml2-2.6.23\win32\bin.msvc D:\zlib123" INC="-ID:\libxml2-2.6.23\include"
enable native perl UTF8
looking for -lxml2... yes
Writing Makefile for XML::LibXML::Common
Si vous n'indiquez pas les chemins d'accès aux librairies, vous obtiendrez ces messsagesNote (probably harmless): No library found for -llibxml2
Note (probably harmless): No library found for -lzlib
etCommon.xs(11) : fatal error C1083: Cannot open include file: 'libxml/parser.h': No such file or directory
si vous n'indiquez pas le chemin d'accès aux fichiers include.
D:\dev\perl\XML-LibXML-Common-0.13>nmake
Microsoft (R) Program Maintenance Utility Version 6.00.8168.0
Copyright (C) Microsoft Corp 1988-1998. All rights reserved.
cp Common.pm blib\lib\XML\LibXML\Common.pm
C:\Perl\bin\perl.exe C:\Perl\lib\ExtUtils/xsubpp -typemap C:\Perl\lib\ExtUtils\typemap -typemap typemap
Common.xs > Common.xsc && C:\Perl\bin\perl.exe -MExtUtils::Command -e mv Common.xsc Common.c cl -c -ID:\libxml2-2.6.23\include -nologo -Gf -W3 -MD -Zi -DNDEBUG -O1 -DWIN32 -D_CONSOLE -DNO_STRICT
-DHAVE_DES_FCRYPT -DNO_HASH_SEED -DUSE_SITECUSTOMIZE -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DUSE_PERLIO
-DPERL_MSVCRT_READFIX -MD -Zi -DNDEBUG -O1 -DVERSION=\"0.13\" -DXS_VERSION=\"0.13\" "-IC:\Perl\lib\CORE"
-DHAVE_UTF8 -DHAVE_BLANK Common.c
Common.c
Running Mkbootstrap for XML::LibXML::Common () C:\Perl\bin\perl.exe -MExtUtils::Command -e chmod 644 Common.bs
.../...
D:\dev\perl\XML-LibXML-Common-0.13>nmake test
Microsoft (R) Program Maintenance Utility Version 6.00.8168.0 Copyright (C) Microsoft Corp 1988-1998. All rights reserved.
C:\Perl\bin\perl.exe "-Iblib\lib" "-Iblib\arch" test.pl
1..8
# Running under perl version 5.008007 for MSWin32
# Win32::BuildNumber 815
# Current time local: Fri May 11 14:02:42 2007
# Current time GMT: Fri May 11 12:02:42 2007
# Using Test.pm version 1.25
ok 1
ok 2
ok 3
ok 4
ok 5
ok 6
ok 7
ok 8
Problème de dépendanceCan't load 'blib\arch/auto/XML/LibXML/Common/Common.dll' for module XML::LibXML::Common:
load_file:Le module spécifié est introuvable at C:/Perl/lib/DynaLoader.pm line 230.
Correspond à un problème de chargement de Common.dll qui a une dépendance avec libxml2.dll.
Veillez donc à ce que cette dernière soit dans le path.
D:\dev\perl\XML-LibXML-Common-0.13>nmake install
Microsoft (R) Program Maintenance Utility Version 6.00.8168.0
Copyright (C) Microsoft Corp 1988-1998. All rights reserved.
Installing C:\Perl\site\lib\auto\XML\LibXML\Common\Common.dll
Installing C:\Perl\site\lib\auto\XML\LibXML\Common\Common.exp
Installing C:\Perl\site\lib\auto\XML\LibXML\Common\Common.lib
Installing C:\Perl\site\lib\auto\XML\LibXML\Common\Common.pdb
Files found in blib\arch: installing files in blib\lib into architecture dependent library tree
Appending installation info to C:\Perl\lib/perllocal.pod
dans l'ordre :
- XML::NamespaceSupport,
- XML::SAX,
- XML::LibXML,
- XML::XPath, Sous windows, il faudra modifier de MakeFile.PL en ajoutant l'extension .pl au fichier de la ligne 'EXE_FILES' => [ 'examples/xpath' ], et ajouter cette extension au fichier indiqué.
- XML::LibXML
Une fois les librairies installées, le code ci-dessous
Donnera cette sortie
0000h: 3c 3f 78 6d 6c 20 76 65 72 73 69 6f 6e 3d 22 31 <?xml version="1 0010h: 2e 30 22 20 65 6e 63 6f 64 69 6e 67 3d 22 55 54 .0" encoding="UT 0020h: 46 2d 38 22 3f 3e 0a 3c 66 6f 6f 20 62 61 72 3d F-8"?>.<foo bar= 0030h: 22 68 65 6c 6c 6f 20 77 6f 72 6c 64 22 2f 3e 0a "hello world"/>. <?xml version="1.0" encoding="UTF-8"?> <foo bar="hello world"/>