Catman...nclude(3pm)
π NAME π
Catmandu::Fix::include β bestie, it's the fix that goes "hold up, lemme grab some more fixes from another file real quick" π«Ά
It's part of the Catmandu::Fix family, documented in the User Contributed Perl Documentation section (that's the 3pm part of Catman...nclude(3pm), iykyk).
β¨ SYNOPSIS β¨
include('/path/to/myfixes.txt')
include('fixes/*.fix')
Literally that simple. Point it at a file, or point it at a glob and watch it eat a whole folder of fixes. π¦
π NOTES π
Okay so the path you give it is relative to a Catmandu load path. Not the filesystem, not your cwd, not vibes β the load path. Let's break it all the way down:
- a catmandu load path is a directory where a catmandu configuration file can be found
- as there are multiple load paths, it will loop through all the path, and include the first file it can find
- in catmandu, the default_load_path is either
- 3.1. the directory of the running script
- 3.2. the parent directory of the running script if the directory is
'bin'
Note: that second one is the sneaky one. If your script lives in abindirectory, Catmandu is like "bestie I'm not looking inbin, I'm looking at the parent ofbin" π
Now the receipts, aka the examples. Every single one, exactly as it comes:
#use default load_path
#called from script "/opt/catmandu-project/fix.pl"
#default_load_path: /opt/catmandu-project
#file must be located at "/opt/catmandu-project/fixes/myfixes.txt"
Catmandu->fixer("include('fixes/myfixes.txt')");
#use default load_path
#called from script "/opt/catmandu-project/bin/fix.pl"
#default_load_path: /opt/catmandu-project (notice the absence of 'bin')
#file must be located at "/opt/catmandu-project/fixes/myfixes.txt"
Catmandu->fixer("include('fixes/myfixes.txt')");
#load fixes, located at /opt/catmandu-project/fixes/myfixes.txt
Catmandu->load("/opt/catmandu-project");
Catmandu->fixer("include('fixes/myfixes.txt')");
#look for 'fixes/myfixes.txt' in /opt/catmandu-project2, and if that fails in /opt/catmandu-project-1
Catmandu->load("/opt/catmandu-project2","/opt/catmandu-project-1");
Catmandu->fixer("include('fixes/myfixes.txt')");
#if "/opt/catmandu-project/fixes/myfixes2.txt" does not exists, the fix will fail
Catmandu->load("/opt/catmandu-project");
Catmandu->fixer("include('fixes/myfixes2.txt)");
See that last one? If the file isn't there, the fix does not gracefully shrug it off. It fails. No cap. π
π The Two Big Gotchas π
circular references are not detected
Fr fr β it will not notice. It will not warn you. It will not save you. π
if the 'include' is enclosed within an if-statement, the fixes are inserted in the control structure, but only executed if the if-statement evaluates to 'true'.
Read that again, because it's giving subtle-but-important. The fixes get inserted into the control structure regardless β they're just not executed unless the condition is true. Two different things, bestie. π
#the fixes in the file 'add_address_fields.txt' are only executed when field 'name' has content,
#but, the fixes are included in the control structure.
if all_match('name','.+')
include('add_address_fields.txt')
end
π SEE ALSO π
Catmandu::Fixβ go read the parent, it's iconic π₯
And that's the whole page, bestie. This one came out of perl v5.40.1, dated 2026-01-24, filed under the Catmandu::Fix::include(3pm) name in the User Contributed Perl Documentation β so if you're holding a different version, check your own docs before you come for me π Mwah, go include some fixes. β¨πΈ
π¦ where this page comes from
- ubuntu resolute: libcatmandu-perl 1.2025-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libcatmandu-perl 1.2025-1 Β· 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