File::Find::Rule::WellFormed - Find well-formed XML documents


File-Find-Rule-WellFormed documentation Contained in the File-Find-Rule-WellFormed distribution.

Index


Code Index:

NAME

Top

File::Find::Rule::WellFormed - Find well-formed XML documents

SYNOPSIS

Top

    use File::Find::Rule qw(:WellFormed);

    my @files = find(wellformed => in => $ENV{HOME});

DESCRIPTION

Top

File::Find::Rule::WellFormed extends File::Find::Rule to find well-formed (or not well-formed) XML documents, by providing the wellformed test:

  my @wellformed = File::Find::Rule->new
                                   ->file
                                   ->name('*.xml')
                                   ->wellformed
                                   ->in('/');

The wellformed test can be reversed, per standard File::Find::Rule semantics:

  # OO
  my @malformed = File::Find::Rule->new
                                  ->file
                                  ->name('*.xml')
                                  ->not_wellformed
                                  ->in('/');

  # functional
  my @malformed = find('!wellformed' => in => '/');

wellformed takes no arguments.

SEE ALSO

Top

File::Find::Rule, File::Find::Rule::Extending, XML::Parser

AUTHOR

Top

darren chamberlain <darren@cpan.org>


File-Find-Rule-WellFormed documentation Contained in the File-Find-Rule-WellFormed distribution.

package File::Find::Rule::WellFormed;

use strict;
use vars qw($VERSION);
use base qw(File::Find::Rule);

use File::Find::Rule;
use XML::Parser;

sub File::Find::Rule::wellformed () {
    my $self = shift->_force_object();

    $self->exec(sub { eval { XML::Parser->new->parsefile(shift) } });
}

1;

__END__