I'm aware of the XML::Parser::Expat Encoding files, and the script works fine when run as a perl script. It's when I try to create an executable using pp that it fails. I tried to manually add the Encodings directory to my package and I still get the failures

This script reproduces the problem

use XML::Twig; my $gPFile = "input_test.xml"; pretty_print(); exit(0); ###################### sub pretty_print { ###################### print "Converting ".$gPFile." to pretty print file ".$gPFile.".pp\n" +; open (TMP,">".$gPFile.".pp"); my $ppml_twig = new XML::Twig(keep_encoding => 0); $ppml_twig->parsefile($gPFile); $ppml_twig->set_pretty_print('indented'); $ppml_twig->print( \*TMP);; close(TMP); }

With this as an input file (input_test.xml)

<?xml version="1.0" encoding="windows-1252"?> <JOB Label="input_test" > <SUBJOB> </SUBJOB> </JOB>

I used the following command to create the executable:

pp -l libexpat.dll -a "C:/Strawberry/perl/site/lib/XML/Parser/Encoding +s;lib/XML/Parser/Encodings" -o pp_only.exe pp_only.pl

I think this may be more of a pp issue than XML::Twig or Parser, but I'm not sure if XML::Twig can be configured to bypass the encoding.


In reply to Re^2: encoding failure with XML::Twig by chastevens
in thread encoding failure with XML::Twig by chastevens

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.