title: How can I fix the "Couldn't create file parser context for file ..." bug with Perl libxml on Debian?
body: <p>When I try to read an XML file with <a href="http://search.cpan.org/dist/XML-Simple" rel="nofollow noreferrer">XML::Simple</a>, sometimes I get this error message:</p>
  
  <blockquote>
    <p>Couldn't create file parser context for file ...</p>
  </blockquote>
  
  <p>After some googling, it seems to be <a href="http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=240334" rel="nofollow noreferrer">a problem with libxml-libxml-perl</a> and is supposed to be fixed in the version I use (1.59-2).</p>
  
  <p>Any ideas?</p>
  
  <p>Edit: (code)</p>
  
  <pre><code>sub Read
  {
    my ($file, $no_option) = @_;
    my %XML_INPUT_OPTIONS = ( KeyAttr =&gt; [], ForceArray =&gt; 1 );
  
    if ((defined $file) &amp;&amp; (-f $file))
    {
      my @stats = stat($file);
      if ((defined $XML_CACHE{$file})
        &amp;&amp; ($stats[9] == $XML_CACHE{$file}{modif_time}))
      {
        return ($XML_CACHE{$file}{xml});
      }
      else
      {
        my $xml = eval { XMLin($file,
          (defined $no_option ? () : %XML_INPUT_OPTIONS)) };
        AAT::Syslog("AAT::XML", "XML_READ_ERROR", $@) if ($@);
        $XML_CACHE{$file}{modif_time} = $stats[9];
        $XML_CACHE{$file}{xml} = $xml;
        return ($xml);
      }
    }
  
    return (undef);
  }
  </code></pre>
  
  <p>And yes, I should &amp; will use <a href="http://search.cpan.org/dist/XML-Simple" rel="nofollow noreferrer">XML::Simple</a> cache feature...</p>