summaryrefslogtreecommitdiffstats
path: root/scripts/MarkdownBook/Document
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/MarkdownBook/Document')
-rw-r--r--scripts/MarkdownBook/Document/HTML.pm4
-rw-r--r--scripts/MarkdownBook/Document/Txt.pm4
2 files changed, 6 insertions, 2 deletions
diff --git a/scripts/MarkdownBook/Document/HTML.pm b/scripts/MarkdownBook/Document/HTML.pm
index 9d61760..2852e8e 100644
--- a/scripts/MarkdownBook/Document/HTML.pm
+++ b/scripts/MarkdownBook/Document/HTML.pm
@@ -18,6 +18,7 @@ use warnings;
use MarkdownBook::Document;
use MarkdownBook::HTMLTree;
+use Carp;
use Text::Markdown;
use HTML::TreeBuilder;
use HTML::Template;
@@ -143,7 +144,8 @@ sub _do_output_template
$doc_tmpl->param(BODY => $body);
- open($doc_fh, '>', $self->file_path() . '.html');
+ open($doc_fh, '>', $self->file_path() . '.html')
+ or croak('Cannot open "' . $self->{'file'} . '" destination document');
$doc_tmpl->output(print_to => $doc_fh);
close($doc_fh);
}
diff --git a/scripts/MarkdownBook/Document/Txt.pm b/scripts/MarkdownBook/Document/Txt.pm
index 6c7f038..cf65d92 100644
--- a/scripts/MarkdownBook/Document/Txt.pm
+++ b/scripts/MarkdownBook/Document/Txt.pm
@@ -17,6 +17,7 @@ use strict;
use warnings;
use MarkdownBook::Document;
+use Carp;
package MarkdownBook::Document::Txt;
@@ -28,7 +29,8 @@ sub output
my $out_fh;
open($out_fh, '>',
- $self->{'book'}->dir() . '/' . $self->{'file'} . '.txt');
+ $self->{'book'}->dir() . '/' . $self->{'file'} . '.txt')
+ or croak('Cannot open "' . $self->{'file'} . '" destination document');
# Print document title.
print($out_fh $self->{'title'} . "\n" .