Newcomen

Description A static content generator.
Newcomen > Perl Modules > Newcomen::Writer::Copy
Source

Index


NAME ^

Newcomen::Writer::Copy - Copies a file.

DESCRIPTION ^

This module provides a writer backend that copies a file. It must not be used directly, see Newcomen::Writer for the writer frontend.

OPTIONS ^

{
   'writer'            => {
      'copy'           => {
         'source_file' => undef,
         'output_file' => undef,
         'output_dir'  => undef,
         'override'    => undef,
      },
   },
}

These are the default options for this writer backend. The user may override any default setting in the configuration file as required. However, plugins may decide to supersede the user defined options. Usually this shouldn't be the case for this writer backend, though.

source_file specifies the absolute path to the file that should be copied. Usually it makes no sense to set this option in the configuration. If this option is undef, the backend looks for the key source_file in the page's meta data (see Newcomen::Page) and uses that instead. If both are undefined (or empty), the backend will die().

output_file should usually not be set in the configuration, i.e. it should be left with the default undef value. It may be used by plugins to set the file name of the output file, relative to the output_dir. If it is undef (the default), the page target will be used as name of the output file, see Newcomen::Page.

The output_dir option specifies the directory to which the files should be written. It has to be specified relative to the project's root directory (the ROOT_DIR option, usually set to the current working directory '.'). The output directory has to exist, it will not be created automatically. If it does not exist, this backend will die(). Subdirectories of the output directory will be created automatically if required. If this option is undef, the backend will try to use the global option writer/output_dir, see Newcomen::Writer.

If the override option is set to a true value, existing files will be overridden. If this option is set to a false value, and an output file already exists, the backend will die(). If this option is undef, the backend will try to use the global option writer/override, see Newcomen::Writer.

CLASS AND INSTANCE METHODS ^

See Newcomen::Writer::Backend.

SEE ALSO ^

Newcomen::Page, Newcomen::Writer, Newcomen::Writer::Backend

VERSION ^

This is version 2014052501.

AUTHOR ^

Stefan Goebel - newcomen {at} subtype {dot} de

COPYRIGHT AND LICENSE ^

Copyright 2013-2014 Stefan Goebel.

This file is part of Newcomen.

Newcomen is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the license, or (at your option) any later version.

Newcomen is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with Newcomen. If not, see <http://www.gnu.org/licenses/>.