Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

masonx::processdir(3pm) [debian man page]

MasonX::ProcessDir(3pm) 				User Contributed Perl Documentation				   MasonX::ProcessDir(3pm)

NAME
MasonX::ProcessDir - Process a directory of Mason 2 templates VERSION
version 0.02 SYNOPSIS
use MasonX::ProcessDir; # Generate result files in the same directory as the templates # my $pd = MasonX::ProcessDir->new( dir => '/path/to/dir' ); $pd->process_dir(); # Generate result files in a separate directory # my $pd = MasonX::ProcessDir->new( source_dir => '/path/to/source/dir', dest_dir => '/path/to/dest/dir' ); $pd->process_dir(); DESCRIPTION
Recursively processes a directory of Mason 2 templates, generating a set of result files in the same directory or in a parallel directory. Every file with suffix ".mc" will be processed, and the results placed in a file of the same name without the suffix. ".mi", autobase and dhandler files will be used by Mason when processing the templates but will not generate files themselves. For example, if the source directory contains Base.mc httpd.conf.mc proxy.conf.mc etc/crontab.mc blah.mi somefile.txt and we run my $pd = MasonX::ProcessDir->new( source_dir => '/path/to/source/dir', dest_dir => '/path/to/dest/dir' ); $pd->process_dir(); then afterwards the destination directory will contain files httpd.conf proxy.conf etc/crontab somefile.txt where foo and bar are the results of processing foo.mc and bar.mc through Mason. Base.mc and blah.mi may be used during Mason processing but won't generate result files themselves. This class is a convenience extension of Any::Template::ProcessDir. CONSTRUCTOR
Specifying directory/directories o If you want to generate the result files in the same directory as the templates, just specify dir. my $pd = MasonX::ProcessDir->new( dir => '/path/to/dir', ... ); o If you want to generate the result files in a separate directory from the templates, specify source_dir and dest_dir. my $pd = MasonX::ProcessDir->new( source_dir => '/path/to/source/dir', source_dir => '/path/to/dest/dir', ... ); Mason options mason_options An optional hash of options to the Mason interpreter. For example, the default Mason data directory will be ".mason" under the source directory, but you can override this: mason_options => { data_dir => '/path/to/data/dir' } Options inherited from Any::Template::ProcessDir See Any::Template::ProcessDir for other options, such as dir_create_mode file_create_mode readme_filename SUPPORT AND DOCUMENTATION
Bugs and feature requests will be tracked at RT: http://rt.cpan.org/NoAuth/Bugs.html?Dist=MasonX-ProcessDir bug-masonx-processdir@rt.cpan.org The latest source code can be browsed and fetched at: http://github.com/jonswar/perl-masonx-processdir git clone git://github.com/jonswar/perl-masonx-processdir.git SEE ALSO
Mason, Any::Template::ProcessDir AUTHOR
Jonathan Swartz <swartz@pobox.com> COPYRIGHT AND LICENSE
This software is copyright (c) 2011 by Jonathan Swartz. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. perl v5.14.2 2012-03-07 MasonX::ProcessDir(3pm)

Check Out this Related Man Page

Any::Template::ProcessDir(3pm)				User Contributed Perl Documentation			    Any::Template::ProcessDir(3pm)

NAME
Any::Template::ProcessDir -- Process a directory of templates VERSION
version 0.07 SYNOPSIS
use Any::Template::ProcessDir; # Process templates and generate result files in a single directory # my $pd = Any::Template::ProcessDir->new( dir => '/path/to/dir', process_text => sub { my $template = Any::Template->new( Backend => '...', String => $_[0] ); $template->process({ ... }); } ); $pd->process_dir(); # Process templates and generate result files to a separate directory # my $pd = Any::Template::ProcessDir->new( source_dir => '/path/to/source/dir', dest_dir => '/path/to/dest/dir', process_file => sub { my $file = $_[0]; # do something with $file, return content } ); $pd->process_dir(); DESCRIPTION
Recursively processes a directory of templates, generating a set of result files in the same directory or in a parallel directory. Each file in the source directory may be template-processed, copied, or ignored depending on its pathname. CONSTRUCTOR
Specifying directory/directories o If you want to generate the result files in the same directory as the templates, just specify dir. my $pd = Any::Template::ProcessDir->new( dir => '/path/to/dir', ... ); o If you want to generate the result files in a separate directory from the templates, specify source_dir and dest_dir. my $pd = Any::Template::ProcessDir->new( source_dir => '/path/to/source/dir', source_dir => '/path/to/dest/dir', ... ); Specifying how to process templates process_file A code reference that takes the full template filename and the "Any::Template::ProcessDir" object as arguments, and returns the result string. This can use Any::Template or another method altogether. By default it calls "process_text" on the contents of the file. process_text A code reference that takes the template text and the "Any::Template::ProcessDir" object as arguments, and returns the result string. This can use Any::Template or another method altogether. Optional parameters dir_create_mode Permissions mode to use when creating destination directories. Defaults to 0775. No effect if you are using a single directory. file_create_mode Permissions mode to use when creating destination files. Defaults to 0444 (read-only), so that destination files are not accidentally edited. ignore_files Coderef which takes a full pathname and returns true if the file should be ignored. By default, all files will be considered. readme_filename Name of a README file to generate in the destination directory - defaults to "README". No file will be generated if you pass undef or if you are using a single directory. template_file_suffix Suffix of template files in source directory. Defaults to ".src". This will be removed from the destination file name. Any file in the source directory that does not have this suffix (or "ignore_file_suffix") will simply be copied to the destination. METHODS
process_dir Process the directory. If using multiple directories, the destination directory will be removed completely and recreated, to eliminate any old files from previous processing. SEE ALSO
Any::Template COPYRIGHT AND LICENSE
This software is copyright (c) 2011 by Jonathan Swartz. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. perl v5.14.2 2012-05-14 Any::Template::ProcessDir(3pm)
Man Page