docs::a...:porting(3)
πΈ NAME πΈ
Apache2::porting β a helper module for mod_perl 1.0 to mod_perl 2.0 porting. Bestie, this page is docs::a...:porting(3) from the User Contributed Perl Documentation shelf, and itβs here to help your old code glow up. β¨
β¨ Synopsis β¨
okay so youβve got two vibe-approved ways to load it β pick one:
# either add at the very beginning of startup.pl
use Apache2::porting;
# or httpd.conf
PerlModule Apache2::porting
# now issue requests and look at the error_log file for hints
Then just issue requests and peek at the error_log file for hints. π
π Description π
Apache2::porting helps you port mod_perl 1.0 code so it runs under mod_perl 2.0. It does not provide any back-compatibility functionality β nope, not that kind of module β but it does know how to trap method calls that are no longer in the mod_perl 2.0 API and tell you what should be used instead, if anything at all. π
If you try to use mod_perl 2.0 methods without first loading the modules that contain them, it will tell you which modules you need to load. And finally, if your code tries to load modules that no longer exist in mod_perl 2.0, itβll also tell you which modules should be used instead. Slay. π
Apache2::porting communicates with users via the error_log file. Every time it traps a problem, it logs the solution (if it finds one) to the error log file. If you use this module coupled with Apache2::Reload, youβll be able to port your applications quickly without needing to restart the server on every modification. Thatβs the dream, fr fr. π¦
π¨ caveat bestie: it starts to work only when child processes start, and it doesnβt work for code that gets loaded at server startup. This limitation is explained in the Culprits section.
It relies heavily on ModPerl::MethodLookup, which can also be used manually to look things up. iykyk. π₯
π Culprits π
Apache2::porting uses the UNIVERSAL::AUTOLOAD function to provide its functionality. However, it seems to be impossible to create UNIVERSAL::AUTOLOAD at the server startup β Apache segfaults on restart. π Therefore it performs the setting of UNIVERSAL::AUTOLOAD only during the child_init phase, when child processes start. As a result, it canβt help you with things that get preloaded at the server startup.
If you know how to resolve this problem, please let us know. To reproduce the problem, try to use an earlier phase, e.g. PerlPostConfigHandler:
Apache2::ServerUtil->server->push_handlers(PerlPostConfigHandler => \&porting_autoload);
META: Though there is a better solution at work, which assignsAUTOLOADfor each class separately, instead of usingUNIVERSAL. See the discussion on the dev list (hint: search the archive forEazyLife).
π See Also π
mod_perl 2.0 documentation. thatβs the one. π
π Copyright π
mod_perl 2.0 and its core modules are copyrighted under The Apache Software License, Version 2.0.
π«Ά Authors π«Ά
The mod_perl development team and numerous contributors.
π thatβs the whole page, bestie β this gem comes from docs::a...:porting(3), perl v5.42.3, dated 2023-10-21. mwah π«Άβ¨
π¦ where this page comes from
- nixos 26.05: mod_perl 2.0.13
- nixpkgs unstable: mod_perl 2.0.13
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms