I have a class that uses XML::Twig to parse a bunch of log file information (you may have seen an earlier post from me this week). Once I got my code working with scripts to test it, I rolled the same code into a CGI script. I get an error from XML::Parser::Expat that looks just like the following:
Can't use string ("<logReader><log date="20010521-") as a symbol ref w +hile "strict refs" in use at /usr/local/lib/perl5/site_perl/5.6.0/sun +4-solaris-thread/XML/Parser/Expat.pm line 456.
First of all, I am not using strict refs (vars, though), it is being set withing XML::Twig. This code behaves differently when being run from the command line (something I am told to expect by some).
The string it is referring to is the XML that I sent to the Twig->parse() command.

On an interesting side note, this is the first time I have written a CGI program, in spite of the fact that I have developed huge provisioning systems, servers, distributed message brokers, etc. all in Perl. I figured it was time for step 1 now that I have been a full time Perl developer for many years. :-)
DrSax

In reply to XML::Twig-parse() error under CGI by DrSax

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.