NAME

Podius::Property::Publishable - Publishable component property


SYNOPSIS

This is an abstract superclass.

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


DESCRIPTION

This module implements general publishable component property.

The subclasses may control the filenames and their contents to be published.


REQUIREMENTS

the Podius::Property manpage.


CONSTRUCTORS

new

description
Class constructor.

parameters
Class name and optional parameters:
  * hashref (may be omitted) with keys 'prefix' or others
  * default filename
  * default label
  * scalarref raw-data

returns
New property object.

new_from_serialized

description
Class constructor. Used for deserialization.

parameters
Class name (like all constructors) and array ref [ content_ref, filename, label ]. Additional parameters are property static parameters (if any).

returns
New formed property reference.


METHODS

get_files_to_publish

description
The default implementation is good for subclasses that use internal fields ``filename'' (or ``filenames'') and ``content_ref'' (or ``content_refs''). Such subclasses should not necessarily overwrite this method.

parameters
Optional boolean flag indicating unpublishing. Note, the returned content_sub is supposed to be used (called) on publishing only.

returns
Arrayref of hashes with keys ``filename'', ``content_sub'', and possibly others like ``label''.

get_filename

parameters
  * optional index inside B<get_files_to_publish>, or filename, default 0
returns
Scalar (file name), or undef.

get_file_dirname

parameters
  * optional index inside B<get_files_to_publish>, or filename, default 0
returns
Scalar (directory name part of the file name), or undef.

get_file_basename

parameters
  * optional index inside B<get_files_to_publish>, or filename, default 0
returns
Scalar (base name part of the file name), or undef.

get_file_extension

parameters
  * optional index inside B<get_files_to_publish>, or filename, default 0
returns
Scalar (extention part of the file name), or undef.

get_content_type

description
This method is intended to be overwritten in subclasses to return the corresponding Content-Type: string, for example Video subclass may return ``video/mpeg''.

A convention for subclasses is to return a common pattern if the given parameter (file name) has no extention or has unknown extention. For example: possible input ``*'', possible output ``video/*''.

parameters
  * optional index inside B<get_files_to_publish>, or filename, default 0
returns
The default implementation returns always ``application/octet-stream'', or ``*/*'' if the input is ``*''. Or undef, if there is no requested file.

reset

description
This method is intended to be overloaded in subclasses to apply more initializations when the property is reset.

The default implementation is to unpublish this property (using its owner component), this removes exiting published files if any.

parameters
None.

returns
None.