NAME

Podius::Property::FileSelection - component property for file name in the given directory


SYNOPSIS

  $property = new Podius::Property::FileSelection;

Supposed to be used in the Podius::Component manpage and the Podius::Property manpage module trees only.


DESCRIPTION

This module implements component property of multiple choices with single selection.


REQUIREMENTS

the Exception manpage, the File::Operations manpage, the Podius::Property::Scalar manpage.


CONSTRUCTORS

new

description
Class constructor.

parameters
Class name, argument hashref and optional initial filename (default is undef).

OPtional keys of argument hashref are: dirname - working directory (scalar, scalarref, or coderef with component as parameter), subdirs - mode (0 is default - files only, 1 - include subdirs, 2 - subdirs only), regexp - regular expression on file name, root - additional root (empty by default) that is usually hidden, but taken in the consideration when real dirs/files are accessed.

returns
New formed property reference.


METHODS

access_dirname

description
This method is used to get or set new directory.

It is possible that this method returns unexisting directory, no check is performed. If empty, the return value is replaced with ``/tmp''.

Accessor: returns the directory string.

Modifier: sets a new directory (like in constructor).

parameters
Accessor: none.

Modifier: directory (scalar, scalarref, or coderef).

returns
Ready to use directoty string.

access_fullpath

description
Only accessor form is available.

This is equivalent to concutenation of file parts access_dirname and access.

returns
Ready to use full file name.

access_root

description
This method is used to get or set new root (empty by default).

Accessor: returns the root directory string.

Modifier: sets a new root directory (like in constructor).

parameters
Accessor: none.

Modifier: root directory (string).

returns
Root directoty string.

access_root_dirname

description
Only accessor form is available.

Like access_dirname, but with root prepended.

returns
Ready to use directoty string.

access_root_fullpath

description
Like access_fullpath, but with root prepended.

returns
Ready to use full file name.

access_all_filenames

description
Only accessor form is available.

Returns a list of all file names (containing no ``/'') in the working directory.

returns
Array ref of scalars.

filter_filenames

description
Filter file names. By default, only real files (no subdirs) are left and there is no further regexp limit for file names. These defaults may be changed in the constructor. The filenames are sorted alphabetically. Subclasses may override this method to implement a different filtering.

parameters
Array ref of scalars.

returns
Array ref of scalars.