hi, i am just a perl beginner. I need to comapre two folders(directories) having xml files and show up the difference, I unable to do that. When I run the below code i get error saying: LWP Request Failed at C:/Perl/site/lib/XML/SAX/PurePerl/Reader/URI.pm

Below is the code:
use XML::Simple; use XML::SemanticDiff; $xml1 = new XML::Simple; $xml2 = new XML::Simple; $dirtoget1="folder1"; $dirtoget2="folder2"; opendir(IMD1, $dirtoget1) || die("Cannot open directory"); opendir(IMD2, $dirtoget2) || die("Cannot open directory"); while( ($filename1 = readdir(IMD1)) && ($filename2 = +readdir(IMD2))) { $file =$xml1->XMLin("$filename1"); $file2 =$xml2->XMLin("$filename2"); my $diff = XML::SemanticDiff->new(); foreach my $change ($diff->compare($filename1, $filename2 +)) { print "$change->{message} in context $change-> +{context}\n"; } # or, if you want line numbers: my $diff = XML::SemanticDiff->new(keeplinenums => 1); foreach my $change ($diff->compare($file, $file2)) { print "$change->{message} (between lines $chan +ge->{startline} and $change->{endline})\n"; } print("$filename1\n"); print("$filename2\n"); print("\n \n \n \n"); } closedir(IMD1); closedir(IMD2);

In reply to error showing LWP request failed by Anonymous Monk

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.