Thank you for your code. This works wonderful for an singular vhost.
(XML::Simple make an stop after one vhost. I don't know why.)
I have multiple vhosts in multiple files and now I have a code which can become analyzed:
foreach for $xml and open/close does not work well.
use Apache::ConfigFile; foreach my $vh_file (@vhost_files) { next if $vh_file =~ /000.*/; my $ac = Apache::ConfigFile->read(file=>"$vhost_path/$vh_file", ig +nore_case=>0, fix_booleans=>0); my @vhkeys = $ac->cmd_context('VirtualHost'); for my $vhkey (@vhkeys) { foreach my $vhost ( $ac->cmd_context(VirtualHost => $vhkey) ) { my $sn=$vhost->cmd_config('ServerName'); $vh{$sn} = $vhost->data; } } } my $xml = XMLout(\%vh, XMLDecl => 1); open(FH,">>/tmp/output1.xml") || die "Unable to open 'output.xml': + $!\n"; print FH $xml; close FH;
In reply to Re^2: Apache::ConfigFile iterate problem
by tpais
in thread Apache::ConfigFile iterate problem
by tpais
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |