| 1 | package XML::Grammar::Fiction::App::ToDocBook; | ||
| 2 | $XML::Grammar::Fiction::App::ToDocBook::VERSION = '0.32.0'; | ||
| 3 | 1 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 1 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | 1 | ▶ | use autodie; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | |||
| 7 | 1 | ▶ | use parent 'Exporter'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 8 | |||
| 9 | our @EXPORT = (qw(run)); | ||
| 10 | |||
| 11 | 1 | ▶ | use Getopt::Long qw/ GetOptions /; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 12 | |||
| 13 | 0 | ▶ | use XML::Grammar::Fiction::ToDocBook (); |
|
Subroutine
BEGIN: called CC=1 SCAR=2.6
| |||
| 14 | |||
| 15 | |||
| 16 | sub run | ||
| 17 | { | ||
| 18 | my $output_fn; | ||
| 19 | |||
| 20 | GetOptions( "output|o=s" => \$output_fn, ); | ||
| 21 | |||
| 22 | if ( !defined($output_fn) ) | ||
| 23 | { | ||
| 24 | die "Output filename not specified! Use the -o|--output flag!"; | ||
| 25 | } | ||
| 26 | |||
| 27 | my $converter = XML::Grammar::Fiction::ToDocBook->new(); | ||
| 28 | |||
| 29 | my $output_text = $converter->translate_to_docbook( | ||
| 30 | { | ||
| 31 | source => { file => shift(@ARGV), }, | ||
| 32 | output => "string", | ||
| 33 | } | ||
| 34 | ); | ||
| 35 | |||
| 36 | open my $out, ">:encoding(utf-8)", $output_fn; | ||
| 37 | print {$out} $output_text; | ||
| 38 | close($out); | ||
| 39 | |||
| 40 | exit(0); | ||
| 41 | } | ||
| 42 | |||
| 43 | 1; | ||
| 44 | |||
| 45 | __END__ | ||