Alien-LibXML
view release on metacpan or search on metacpan
NAME
Alien::LibXML - install the C libxml2 library on your system
SYNOPSIS
use 5.010;
use strict;
use Alien::LibXML;
my $alien = Alien::LibXML->new;
say $alien->libs;
say $alien->cflags;
DESCRIPTION
Hopefully at some point, XML::LibXML's installation scripts might use
Alien::LibXML to locate or install the C libxml2 library.
AUTHOR
Toby Inkster <tobyink@cpan.org>.
COPYRIGHT, LICENCE AND DISCLAIMER OF WARRANTIES
Copyright (c) 2012-2014 Toby Inkster.
examples/synopsis.pl view on Meta::CPAN
use 5.010;
use strict;
use Alien::LibXML;
my $alien = Alien::LibXML->new;
say $alien->libs;
say $alien->cflags;
lib/Alien/LibXML.pm view on Meta::CPAN
Alien::LibXML - install the C libxml2 library on your system
=head1 SYNOPSIS
use 5.010;
use strict;
use Alien::LibXML;
my $alien = Alien::LibXML->new;
say $alien->libs;
say $alien->cflags;
=head1 DESCRIPTION
Hopefully at some point, L<XML::LibXML>'s installation scripts might use
Alien::LibXML to locate or install the C libxml2 library.
=head1 AUTHOR
Toby Inkster E<lt>tobyink@cpan.orgE<gt>.
t/01-compiler.t view on Meta::CPAN
-x $CC
or plan skip_all => "$CC is not executable";
};
use Alien::LibXML;
use Text::ParseWords qw( shellwords );
sub file ($) { File::Spec->catfile(split m{/}, $_[0]) }
my @libs = shellwords( Alien::LibXML->libs );
my @cflags = shellwords( Alien::LibXML->cflags );
@libs = map { $_ =~ /^-L(.*)$/ && -d File::Spec->catfile($1, '.libs') ? ($_, "-L" . File::Spec->catfile($1, '.libs')) : $_ } @libs;
if($^O eq 'MSWin32') {
# on windows, the dll must be in the PATH
push @PATH, $_ for map { my $p = $_; $p =~ s{^-L}{}; $p } grep { /^-L/ } @libs;
}
diag "COMPILER: $CC";
diag "CFLAGS: @cflags";
diag "LIBS: @libs";
diag "OUTPUT: @{[ file 't/tree1.exe' ]}";
diag "INPUT: @{[ file 't/tree1.c' ]}";
system(
$CC, @cflags,
-o => file 't/tree1.exe',
file 't/tree1.c',
@libs,
);
ok -x 't/tree1.exe';
my $cmd = sprintf '%s %s', file 't/tree1.exe', file 't/tree1.xml';
is(`$cmd`, <<'EXPECTED');
node type: Element, name: root
* copy: see Copyright for the status of this software.
*/
#include <stdio.h>
#include <libxml/parser.h>
#include <libxml/tree.h>
#ifdef LIBXML_TREE_ENABLED
/*
*To compile this file using gcc you can type
*gcc `xml2-config --cflags --libs` -o xmlexample libxml2-example.c
*/
/**
* print_element_names:
* @a_node: the initial xml node to consider.
*
* Prints the names of the all the xml elements
* that are siblings or children of a given xml node.
*/
static void
( run in 3.408 seconds using v1.01-cache-2.11-cpan-94b05bcf43c )