'invalid token' error and segmentation fault (XML issue?)

D

dn.perl

I have started getting an error:
not well-formed (invalid token) at line 12 -- but the error-log does
not say which file happens to have this invalid token.

If it helps, the shell script has started giving Segmentation fault
for:
echo $PERL extract-history.pl --start "$dt 00:00:00"
But in the very next line, it seems to call correctly:
/home/y/bin/perl extract-history.pl --start 2011-08-02 00:00:00

Well, extract-history.pl does use Data::Dumper, but it is difficult to
say where any xml or utf-8 related stuff may be popping up and causing
the error messages.

These scripts were working perfect until 10 hours ago.

Please advise.
 
B

Bjoern Hoehrmann

* (e-mail address removed) wrote in comp.lang.perl.misc:
I have started getting an error:
not well-formed (invalid token) at line 12 -- but the error-log does
not say which file happens to have this invalid token.

If it helps, the shell script has started giving Segmentation fault
for:
echo $PERL extract-history.pl --start "$dt 00:00:00"
But in the very next line, it seems to call correctly:
/home/y/bin/perl extract-history.pl --start 2011-08-02 00:00:00

Well, extract-history.pl does use Data::Dumper, but it is difficult to
say where any xml or utf-8 related stuff may be popping up and causing
the error messages.

Well, you don't tell us what the code is and don't tell us what the
input is, and you claim there is a segmentation fault, but a segmen-
tation fault would not come with a "not well-formed (invalid token)"
error message. The error message is most likely from `expat`, an XML
parser that is used by modules such as XML::parser. Your favourite
search engine should point out, for a query like '"not well-formed
(invalid token)" perl' the perl-xml FAQ

http://perl-xml.sourceforge.net/faq/#not_well_formed

which lists a couple of common errors in XML documents that trigger
this error. Most likely your script obtains an XML document from
somewhere, and the document is not well-formed, meaning it cannot be
parsed by typical XML processors. In order to address this, you would
have to find out where the malformed document is coming from and fix
it (or have others fix it, or find some workaround), or otherwise re-
move the errorneous document from the process modeled by the script.

It might help to use a debugger or profiler to get a better idea of
what the script does, like which modules are involved, where the XML
parsing code is called from, and so on.
 
I

Ilya Zakharevich

I have started getting an error:
not well-formed (invalid token) at line 12 -- but the error-log does
not say which file happens to have this invalid token.

You need to provide an exact error message (including newlines).
If it helps, the shell script has started giving Segmentation fault
for:
echo $PERL extract-history.pl --start "$dt 00:00:00"
But in the very next line, it seems to call correctly:
/home/y/bin/perl extract-history.pl --start 2011-08-02 00:00:00

Likewise.

Note that a shell SCRIPT cann't be "giving Segmentation fault". You
need to find which EXECUTABLE faults before asking for help...

Ilya
 
D

dn.perl

Jurgen was off by 6 lines.
A semi-colon was missing in line 48 (not 42), the error said line 12, which
is (48/4). And 12 = (48/6) + 4.

A totally unsuspected line had created the issue. I had to comment out a
block of 20 lines and find the offending line by uncommenting these 20 lines
one-by-one. The owner of a called script (which gives out the vague
error-message: not-well-formed line 12, no-filename-mentioned) has since
fixed the issue.

Will sort out later why the 'segmentation fault' error also appeared in the
bargain.
Thanks for the leads, Bjoern and Ilya. The 'segmentation fault' error really
threw me off balance.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,899
Latest member
RodneyMcAu

Latest Threads

Top