MojoMojo::Formatter::File(3) format file as XHTML


This formatter will format the file argument as XHTML.

Usage: {{file TYPE filename}}

       {{file Text uploads/Files/test.txt}}

TYPE is a plugin present in Formatter/File/ directory.

Currently there are only three: Pod, DocBook and Text

The plugin TYPE format only the file which the extension match with 'can_format' method. Respectively pod, xml and txt for existing plugins.

For security reasons the path of file must be include in 'whitelisting' directory. You can use path_to(DIR) to describe directory in mojomojo.conf:

Just an example to view the test pod file t/var/files/test.pod :

Add this to mojomojo.conf :

    prefix_url /myfiles
    whitelisting __path_to(t/var/files)__ </Formatter::Dir>

To see the pod content formatted in xhtml, write in the text area:

{{file Pod path_to(t/var/files)test.pod}}

To show recursively all files of directory see script/util/ script. To test it:

# start mojomojo


# run dir2mojomojo script

./script/util/ --dir=~/dev/mojomojo/t/var/files/ --url=/myfiles

Connect to http://server:3000/myfiles/


Format order can be 1-99. The File formatter runs on 92.
Calls the formatter. Takes a ref to the content as well as the context object.
Return the plugin to use with file attachment
Return the content formatted
Return 0 if plugin exist
Directory must be include in whitelisting


Daniel Brosseau <[email protected]>


This module is licensed under the same terms as Perl itself.