| 1 | #!/usr/local/bin/perl |
| 2 | |
| 3 | # Original authors: don |
| 4 | # $Revision: $ |
| 5 | |
| 6 | |
| 7 | use strict; |
| 8 | use warnings; |
| 9 | use Carp; |
| 10 | use Getopt::Long qw(:config no_ignore_case bundling); |
| 11 | use Pod::POM; |
| 12 | |
| 13 | # main |
| 14 | { |
| 15 | # local($SIG{__DIE__}) = sub { &Carp::confess }; |
| 16 | my $self = bless { }; |
| 17 | |
| 18 | my $top_dir; |
| 19 | # Set up @INC to get right version of module |
| 20 | use File::Spec (); |
| 21 | BEGIN { |
| 22 | my $path = File::Spec->rel2abs($0); |
| 23 | (my $dir = $path) =~ s{(?:/[^/]+){2}\Z}{}; |
| 24 | # unshift @INC, $dir . "/blib/lib", $dir . "/blib/arch"; |
| 25 | unshift @INC, $dir . "/lib"; |
| 26 | |
| 27 | $top_dir = $dir; |
| 28 | } |
| 29 | |
| 30 | my $test_dir = $top_dir . "/test_doc/source"; |
| 31 | |
| 32 | use Pod::POM::View::Restructured; |
| 33 | |
| 34 | my $view = Pod::POM::View::Restructured->new; |
| 35 | my $parser = Pod::POM->new; |
| 36 | my $pom = $parser->parse_file("$top_dir/lib/Pod/POM/View/Restructured.pm"); |
| 37 | my $out = $pom->present($view); |
| 38 | |
| 39 | my $out_file = $test_dir . "/restructured.rst"; |
| 40 | open(my $out_fh, '>', $out_file) or die "couldn't open output file $out_file"; |
| 41 | binmode($out_fh, ':utf8'); |
| 42 | print $out_fh $out; |
| 43 | close $out_fh; |
| 44 | |
| 45 | # print "output:\n\n$out\n"; |
| 46 | |
| 47 | } |
| 48 | |
| 49 | exit 0; |
| 50 | |
| 51 | ############################################################################### |
| 52 | # Subroutines |