MasonX...essDir(3pm)
π
MasonX::ProcessDir β or, as your shell knows it, MasonX...essDir(3pm)
okay bestie, gather round, because this one is genuinely a little gem and i need you to know about it. it's a Perl module, it's documented in the user-contributed Perl docs section, and it does exactly one thing extremely well: it takes a whole directory of Mason 2 templates and cooks them into result files. no cap. π
β¨ NAME β¨
MasonX::ProcessDir β Process a directory of Mason 2 templates π¦
πΈ VERSION πΈ
version 0.02 π
π SYNOPSIS π
here's the whole vibe in code form, literally copy-paste ready:
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 π
so what it does is: it goes recursively through a directory of Mason 2 templates and spits out a whole set of result files β either right there in the same directory, or in a parallel directory of your choosing. main character energy for build scripts, honestly.
every single file with the suffix .mc gets processed, and its result lands in a file with the same name minus that suffix. meanwhile .mi files, autobase files and dhandler files? those get used by Mason while it's doing its thing, but they do not generate files themselves. they're the supporting cast, not the leads. π
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. π«Ά
and like β this class is a convenience extension of Any::Template::ProcessDir. it's the glow-up, not a whole new species. β¨
π§ CONSTRUCTOR π§
π Specifying directory/directories
- if you want the result files to land in the same directory as the templates, you literally just specify
dir. that's it. that's the whole move. π
my $pd = MasonX::ProcessDir->new(
dir => '/path/to/dir',
...
);
- if you want the result files in a separate directory from the templates, you specify
source_diranddest_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 passed to the Mason interpreter. for example, the default Mason data directory will be.masonunder the source directory, but you can override that, no problem:
mason_options => { data_dir => '/path/to/data/dir' }
π Options inherited from Any::Template::ProcessDir
go check Any::Template::ProcessDir for the other options, such as
dir_create_mode
file_create_mode
readme_filename
β SUPPORT AND DOCUMENTATION β
bugs and feature requests will be tracked at RT β yes, RT, the classic. bring your receipts:
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
iykyk. πΈ
π 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.
and that's the whole page bestie, periodt. π
perl v5.34.0 Β· 2022-06-15 Β· and this manual page's very own name, MasonX...essDir(3pm) β she's iconic, she's truncated, she slays. π«Άβ¨
π¦ where this page comes from
- debian bookworm: libmasonx-processdir-perl 0.02-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libmasonx-processdir-perl 0.02-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libmasonx-processdir-perl 0.02-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libmasonx-processdir-perl 0.02-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libmasonx-processdir-perl 0.02-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms