Apache-AxKit-Provider-File-Formatter

 view release on metacpan or  search on metacpan

lib/Apache/AxKit/Provider/File/Formatter.pm  view on Meta::CPAN

  }
  
  # From SUPER:
  my $fh = $self->SUPER::get_fh();
  local $/;
  my $contents = <$fh>;
  
  my $whichformatter = $r->dir_config('FormatterModule');
  AxKit::Debug(5, "Formatter Provider configured to use " . $whichformatter);
  unless ($whichformatter =~ m/^Formatter::\w+::\w+$/) {
    throw Apache::AxKit::Exception::Error( -text => "$whichformatter doesn't look like a formatter to me");
  }
  eval "use $whichformatter";
  throw Apache::AxKit::Exception::Error( -text => $whichformatter . " not found, you may need to install it from CPAN") if $@;
  my $formatter = "$whichformatter"->format($contents);
  my $parser = XML::LibXML->new();
  return $parser->parse_html_string($formatter->document);
}



sub get_strref { return \ shift->get_dom->toString; }


sub get_fh {
   throw Apache::AxKit::Exception::IO( -text => "Can't get fh for Formatter" );
}


=head1 SEE ALSO

The L<Formatter> API specification.

The currently existing Formatters: L<Formatter::HTML::HTML>,
L<Formatter::HTML::Textile> and L<Formatter::HTML::Preformatted>. Some
other Providers may also be of interest:



( run in 0.362 second using v1.01-cache-2.11-cpan-496ff517765 )