Subject: | Segmentation fault at the very end of a script |
Date: | Wed, 10 Dec 2008 16:48:29 +0100 |
To: | bug-XML-Twig [...] rt.cpan.org |
From: | "henridamien.laurent" <henridamien.laurent [...] biblibre.com> |
Hi
I am working on different Linux machines, XML::Twig is quite impressive, but
I happen to have a seg fault problem with a script of mine :
It occurs at the very end of the script, so process is OK, but it still
is quite uncomfortable.
And I would like to find out why it is so.
XML file is quite big : 12Mo
But I think it should be OK.
is there something I should know ? Some thing I should do to provide you
with enough information ?
#!/usr/bin/perl
use XML::Twig;
use XML::Twig::XPath;
use Data::Dumper;
use Getopt::Long;
use utf8;
use strict;
# buffers for holding text
my %concepthash;
my %mthash;
my %BT;
my %NT;
my ($filename,$force);
GetOptions(
'file:s' => \$filename,
'f' => \$force,
);
# initialize parser with handlers for node processing
my $twig = new XML::Twig::XPath( TwigHandlers => {
"/th/langue/record" => \&concepthash,
"/th/langue/mt" => \&mthash,
});
# parse, handling nodes on the way
$twig->parsefile( $filename );
my %mtdiff;
my @nodeset = $twig->get_xpath('/th/langue[@lang-id="fre"]/record');
my (%modelem, %createelem, %newelem, %unmodifiedelem);
CONCEPT :foreach my $elem (@nodeset) {
# Construction de l'enregistrement candidat
my $id= $elem->att( 'id' );
#process process process .....
#uses hashes
}
my %BT;
my %NT;
# initialize parser with handlers for node processing
my @nodeset = $twig->get_xpath('/th/langue[@lang-id!="fre"]/record');
foreach my $elem (@nodeset){
my $id= $elem->att( 'id' );
# Process Process Process
#uses hashes
}
$twig->dispose;
# handle a concept element to build the concepts hash.
sub concepthash {
my( $tree, $elem ) = @_;
# Process Process Process
#creates a concept hash
}
sub mthash {
my( $tree, $elem ) = @_;
# Process Process Process
#creates an mt hash
}
--
Henri-Damien LAURENT
BibLibre SARL
http://www.biblibre.com
Expert en Logiciels Libres pour l'info-doc
tel : +33 4 67 65 75 50