NAME

Getopt::Pad::Type::File - The file option type

SYNOPSIS

options => {
    input  => { type => 'file', mustExist => 1 },
    output => { type => 'file', createPathIfMissing => 1 },
},

DESCRIPTION

The type of options and args declared with type => 'file'. It accepts any path and returns it as given; a leading ~ is not expanded.

  • With mustExist, the path must be an existing file (-f); a missing path is rejected with file 'PATH' does not exist, a directory with 'PATH' is not a file.

  • With createPathIfMissing, a missing file is created empty, together with its missing parent directories, for the value that is finally used. An existing file is not touched.

The help output labels the option [File Path], and shell completion completes file names. See "file" in Getopt::Pad and "Type-specific keys" in Getopt::Pad.

SEE ALSO

Getopt::Pad::Type::Dir, Getopt::Pad::Type::Path

AUTHOR

davenonymous <perl@davenonymous.com>

COPYRIGHT AND LICENSE

Copyright 2026 davenonymous

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.