diff options
author | P. J. McDermott <pjm@nac.net> | 2012-08-12 10:08:43 (EDT) |
---|---|---|
committer | P. J. McDermott <pjm@nac.net> | 2012-08-12 10:08:43 (EDT) |
commit | 04d0684d2da625037e6472639d1884fb9a55ac83 (patch) | |
tree | 2a87ad49ac9a7266df5011810fafc6bc0c0043ff /scripts/MarkdownBook/Document/HTML.pm | |
parent | c0f12961b11ab4f8ec839c911dd5d4dff03a7092 (diff) |
Improve error handling.
Diffstat (limited to 'scripts/MarkdownBook/Document/HTML.pm')
-rw-r--r-- | scripts/MarkdownBook/Document/HTML.pm | 4 |
1 files changed, 3 insertions, 1 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); } |