Hola Senors y Senioritas:
Does anyone know why XML::Twig would dump core when perl (perl v5.8.0 on sun4-solaris) is done executing a program? Their are two odd things about this anomaly:
1) The program that is using the module (code included below) seems to be working perfectly 99% of the time with data sources that are similar to the one that is failing (the failing XML source can be found at http://www.statenet.com/sama/BILLTEXT_20011025_0_N.xml).
2) The program actually gives correct output if STDOUT is autoflushed. However, after the program exits (I tested this by printing a line of text to STDERR just before the end of the code), it seems that perl dumps core.
The perl source is listed below:
#!/usr/local/bin/perl
use strict;
(my $prog = $0) =~ s-.*/--;
my $usage = "USAGE: $prog xml_file";
@ARGV == 1 or die "$usage\n";
# $xml_file = http://www.statenet.com/sama/BILLTEXT_20011025_0_N.xml
my ($xml_file) = shift;
unless (-f "$xml_file" ) {
die "$prog: FATAL: File: $xml_file does not exist\n";
}
use DBI;
use XML::Twig;
my $twig = XML::Twig->new(
pretty_print => 'indented',
load_DTD => 1,
);
unless ( $twig->safe_parsefile($xml_file) ) {
die "$prog: FATAL: Failed parse of $xml_file...\n";
}
my $root = $twig->root();
my $billtext = $root->children('billtext');
my $version_date_xml = $billtext->first_child('billtext_version_date')
+;
my $version_date = $version_date_xml->text;
my $verseq = parse XML::Twig::Elt("<billtext_version_sequence>0</billt
+ext_version_sequence>");
$verseq->paste(after => $version_date_xml);
$twig->flush(Update_DTD => 1);
# print(STDERR "Hey, look, I still haven't dumped core!!!\n");
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.