The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

App::Wubot::Reactor::CleanFilename - build a clean filename or directory name from a field

VERSION

version 0.3.8

SYNOPSIS

  - name: clean filename
    plugin: CleanFilename
    config:
      field: filename_base

  - name: clean filename
    plugin: CleanFilename
    config:
      field: directory
      directory: 1
      lc: 1

DESCRIPTION

This plugin will take the contents of a field and make it into a safe filename. This includes replacing any characters other than the following with underscores:

  a-z, A-Z, 0-9
  _ (underscore)
  - (dash)
  . (period)

If the 'directory' config param is set, then a forward slash will also be allowed in the name. This can be useful with the MakeDirectory plugin.

Setting the 'lc' config param will lower-case the contents.

Some additional cleanup is done to make the filename pretty:

  multiple consecutive underscores are replaced with a single underscore
  _-_ will be replaced with simply -
  "foo's thing" will become "foos_thing" rather than "foo_s_thing"

SUBROUTINES/METHODS

react( $message, $config )

The standard reactor plugin react() method.