Apache-AxKit-Provider-PodSAX

 view release on metacpan or  search on metacpan

PodSAX.pm  view on Meta::CPAN

@ISA = ('Apache::AxKit::Provider::File');
$VERSION = '1.00';

use Apache::AxKit::Provider::File;
use XML::SAX::Writer;
use Pod::SAX;

sub get_strref {
    my $self = shift;
    if ($self->_is_dir()) {
        throw Apache::AxKit::Exception::IO(
          -text => "$self->{file} is a directory - please overload File provider and use AxContentProvider option");
    }

    my $outie;
    my $w = XML::SAX::Writer->new( Output => \$outie );
    my $generator = Pod::SAX->new( Handler => $w) ;

    eval {
      $generator->parse_uri( $self->{file} );
        };

    if (my $error = $@) {
        throw Apache::AxKit::Exception::IO(
          -text => "PodSAX Generator Error: $error");
    }
    #warn "OUTIE $outie \n";
    return \$outie
}

sub process {
    my $self = shift;

    my $file = $self->{file};

PodSAX.pm  view on Meta::CPAN

        ($self->{apache}->content_type() =~ /^text\/pod/)
        ) {
            return 1;
    }

    AxKit::Debug(5, "'$file' not recognised as POD");
    return 0;
}

sub get_fh {
    throw Apache::AxKit::Exception::IO(
          -text => "Can't get filehandles from POD"
    );
}

1;
__END__
# Below is stub documentation for your module. You better edit it!

=head1 NAME



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