#!/usr/bin/perl -- use strict; use warnings; use XML::Twig; use Data::Dump qw' dd '; Main( @ARGV ); exit( 0 ); sub Main { my %files; my $filename; my $ssprint = sub { # my( $twig, $elt ) = @_; # my( $twig, $_ ) = @_; # $_ is $elt push @{ $files{ $filename }{ $_->path } }, $_->sprint; return; }; my $twig = XML::Twig->new( pretty_print => 'indented', TwigHandlers => { 'panoply/classes' => $ssprint, 'panoply/files' => $ssprint, 'panoply/namespaces' => $ssprint, }, ); for my $file( @_ ){ dd $filename = $file; ## eval { $twig->parsefile( $file ); 1; } or warn "ERROR parsefile($file): $@ "; $twig->purge; } dd \%files; } __END__ "panolpy.985318.xml" "panolpy.985465.xml" { "panolpy.985318.xml" => { "/panoply/classes" => [ "\n \n \n \n \n \n \n \n Models the access logic\n \n \n \n \n \n \n \n \n \n \n Gets the current access logic for...\n \n \n \n \n \n \n \n \n \n \n \n \n \n ", "\n \n \n \n \n ", ], "/panoply/files" => [ "\n \n \n ", "\n \n \n \n \n \n \n \n ", ], }, "panolpy.985465.xml" => { "/panoply/classes" => [ "\n \n \n \n \n \n Models the access logic\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n ", "\n \n \n \n ", "\n \n \n \n ", "\n \n \n ", ], "/panoply/files" => [ "\n ", "\n \n \n \n \n \n ", ], "/panoply/namespaces" => [ "\n \n \n ", "\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n ", "\n \n \n ", ], }, }