I have managed to get a workround by calling the parser from another program which feeds it one file at a time:
#! /usr/bin/perl use strict; use warnings; use Fcntl; use Getopt::Long; use POSIX; my ($xmlfile, $ctlfile, $config); my @xmlfiles; ### HANDLE COMMAND LINE OPTIONS GetOptions('config|c=s' => \$config, 'ctlfile|ctl=s' => \$ctlfile, 'xmlfile|x=s' => \$xmlfile,); if ($xmlfile) # xmlfile specified on cmd line { ($xmlfile = $1) = $xmlfile =~ /^(\w+\.*\w+)$/i; push @xmlfiles, $xmlfile; } elsif ($config) # xmlfiles in config file { sysopen(XMLFILES, $config, O_RDONLY) or die "Can't open $config : $!"; my @config = <XMLFILES>; foreach my $line (@config) { next if (($line =~ /^#+/) || ($line =~ /^\s+$/)) ; chomp($line); push @xmlfiles, $line; } close XMLFILES; } else # try default filename then bale out { $xmlfile = "multimers.pisa", if (-e "multimers.pisa" and -s "multi +mers.pisa"); if ($xmlfile) { print "Using default xml file $xmlfile\n"; ($xmlfile = $1) = $xmlfile =~ /^(\w+\.*\w+)$/i; push @xmlfiles, $xmlfile; } else { die "No valid xmlfile specified...exiting\n"; } } foreach my $file (@xmlfiles) { system "xml_pisa.pl $file"; # this calls the original + # twig parsing script }


In reply to Re^2: parsing multiple xml files with xml::twig by diomedea
in thread parsing multiple xml files with xml::twig by diomedea

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.