File::Stubb::Render(3)

NAME
File::Stubb::Render - Stubb template rendering class

USAGE
  use File::Stubb::Render;

  my $render = File::Stubb::Render->new(
    template => '/path/to/template',
    subst    => { one => 1, two => 2 },
  );

  my @created = $render->render('/path/to/output');

DESCRIPTION
File::Stubb::Render is a module that provides an object-oriented interface to stubb's template rendering routines. This is a private module for stubb. For user documentation, consult the stubb manual.

METHODS

$render = File::Stubb::Render->new(%params)
    Creates a new File::Stubb::Render object from %params. The following are valid parameters:

    template
        Path to template file. Required

    subst
        Hash ref of substitution parameters.

    render_hidden
        Boolean determining whether to render hidden files from a template directory. Defaults to false.

    follow_symlinks
        Boolean determining whether to render the file symlinks point to, or to copy the symlinks themselves in template directories. Defaults to true.

    copy_perms
        Boolean determining whether to copy the permissions of a template file when rendering. Defaults to false.

    defaults
        Boolean determining whether to use any default substitution parameters provided by a template's .stubb.json.

    ignore_config
        Boolean determining whether a template's config file should be ignored during initialization or not. Defaults to false.

@created = $render->render($output)
    Render template to $output. Returns a list of created files.

    For documentation on how stubb renders files, consult the stubb manual.

$targets = $render->targets()
    Returns a hash ref list of targets in the object's template. The hash ref will look something like this:

      {
        basic => [ ... ],
        perl  => [ ... ],
        shell => [ ... ],
      }

$new = $render->render_path($path)
    Renders $path as a path name.

$template = $render->template()
    Get the path to $render's template file.

$subst = $render->subst()
$render->set_subst($subst)
    Getter/setter for $render's substitution parameter hash ref.

$hidden = $render->hidden()
$render->set_hidden($hidden)
    Getter/setter for $render's render hidden files flag.

$follow = $render->follow_symlinks()
$render->set_follow_symlinks($follow)
    Getter/setter for $render's follow symlinks flag.

$copy = $render->copy_perms
$render->set_copy_perms($copy)
    Getter/setter for $render's copy perms flag.

$def = $render->defaults()
    Getter for $render's defaults flag.

$ign = $render->ignore_config()
    Getter for $render's ignore_config flag.

AUTHOR
Written by Samuel Young, <samyoung12788@gmail.com>.

This project's source can be found on its Codeberg page <https://codeberg.org/1-1sam/stubb.git>. Comments and pull requests are welcome!

COPYRIGHT
Copyright (C) 2025 Samuel Young

This program 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.

SEE ALSO
stubb