Loading ...
Sorry, an error occurred while loading the content.
 

LibXML + parse_file + exception in eval

Expand Messages
  • sivaji kondapalli
    Hi ppl, use strict; use 5.004; use XML::LibXML; sub a() { my $parser = XML::LibXML- new(); eval{ my $tree = $parser- parse_file( dummy.xml ); }; if ($@) { die
    Message 1 of 1 , Oct 12, 2006
      Hi ppl,


      use strict;
      use 5.004;
      use XML::LibXML;

      sub a()
      {
      my $parser = XML::LibXML->new();
      eval{
      my $tree = $parser->parse_file("dummy.xml");
      };
      if ($@)
      {
      die "Error: $@ \n";
      }
      else
      {
      die "Success \n";
      }
      }

      eval
      {
      my $x = a();
      };
      if ($@)
      {
      print "FOUND THE PROBLEM\n";
      }

      Here dummy.xml is an invalid xml file. If I execute the above code from my home directory, I am able to see the output as expected but, if I execute the same in mod-perl environment, exception raised by parse_file are also printed to command prompt, though they are in eval block.

      So I wanted to know though we keep some stuff in eval block exceptions exceptions be raised? if so , how to stop it.

      thanks
      sivaji k

      Send instant messages to your online friends http://uk.messenger.yahoo.com

      [Non-text portions of this message have been removed]
    Your message has been successfully submitted and would be delivered to recipients shortly.