Text::Amuse::Compile - Compiler for Text::Amuse
Version 0.13
use Text::Amuse::Compile; my $compiler = Text::Amuse::Compile->new; $compiler->compile($file1, $file2, $file3)
Constructor. It will accept the following options
Format options (by default all of them are activated);
Remove auxiliary files after compilation (.status, .ok)
LaTeX output
Plain PDF without any imposition
PDF imposed on A4 paper
PDF imposed on Letter paper
Full HTML output
The EPUB
The bare HTML, non <head>
The zipped sources
An hashref of key/value pairs to pass to each template in the options namespace.
options
Template directory:
The directory where to look for templates, named as format.tt
You can retrieve the value by calling them on the object.
The Text::Amuse::Compile::Templates object, which will provide the templates string references.
Report version information
Subroutine reference for logging.
Compile recursive a directory, comparing the timestamps of the status file with the muse file. If the status file is newer, the file is ignored.
Return a list of absolute path to the files processed. To infer the success or the failure of each file look at the status file or at the logs.
Return a sorted list of files with extension .muse excluding illegal names (including hidden files) and directories.
As above, but check the age of the status file and skip already processed files.
Main method to get the job done, passing the list of muse files. You can inspect the errors calling errors. It does produce some output.
errors
The file may also be an hash reference. In this case, the compile will act on a list of files and will merge them. Beware that so far only the pdf and tex options will work, while the other html methods will throw exceptions or (worse probably) produce empty files. This will be fixed soon. This feature is marked as experimental and could change in the future.
pdf
tex
The hash reference should have those mandatory fields:
An arrayref of filenames without extension.
A mandatory directory where to find the above files.
Optional keys
Default to virtual. This is the basename of the files which will be produced. It's up to you to provide a sensible name we don't do any check on that.
Defaults to '.muse' and you have no reason to change this.
Every other key is the metadata of the new document, so usually you want to set title and optionally author.
title
author
Example:
$c->compile({ # mandatory path => File::Spec->catdir(qw/t merged-dir/), files => [qw/first second/], # recommended name => 'my-new-test', title => 'My new shiny test', # optional subtitle => 'Another one', date => 'Today!', source => 'Text::Amuse::Compile', });
You can pass as many hashref you want.
This method is called when the compilation of a file raises an exception, so it's for internal usage.
It passes the arguments along to report_failure_sub as a list if you set that to a sub, otherwise it prints to the standard error.
report_failure_sub
You can set the sub to be used to report problems using this accessor, which is supposed to receive the list of messages.
Accessor to the catched errors. It returns a list of strings.
Add an error. [Internal]
Reset the errors
Marco Pessotto, <melmothx at gmail.com>
<melmothx at gmail.com>
Please mail the author and provide a minimal example to add to the test suite.
You can find documentation for this module with the perldoc command.
perldoc Text::Amuse::Compile
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.
To install Text::Amuse::Compile, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Text::Amuse::Compile
CPAN shell
perl -MCPAN -e shell install Text::Amuse::Compile
For more information on module installation, please visit the detailed CPAN module installation guide.