Autodi...er::PHP(3pm)
β¨ NAME β¨
Autodia::Handler::PHP β bestie, it's the AutoDia handler for PHP π
(also hi, this page is from the User Contributed Perl Documentation, section 3pm, so you already know it's giving "I live in your perldoc" energy π)
πΈ INTRODUCTION πΈ
Autodia::Handler::PHP gets registered inside the Autodia.pm module, okay? And that module is literally just holding a hash of language names mapped to the name of their respective language handler β which in this case is, you guessed it, PHP. Obsessed. π
%language_handlers = ( .. , php =>
"Autodia::Handler::PHP", .. );
%patterns = ( .. , php => \%php,
.. );
my %php = (
regex => '\w+\.php$',
wildcards => [
"php","php3","php4"
],
);
So the regex is '\w+\.php$' and the wildcards are "php", "php3", and "php4". Slay. That's the whole vibe check right there π¦
π«Ά CONSTRUCTION METHOD π«Ά
Not me showing you how to actually build one of these. Periodt:
use Autodia::Handler::PHP;
my $handler = Autodia::Handler::PHP->New(\%Config);
What's happening here: you're creating a brand new handler, and you're feeding it the Configuration hash so it knows which rules were selected at the command line. It's giving "the config is the blueprint, the handler is the main character" β¨
π ACCESS METHODS π
π Parse
$handler->Parse(filename); # where filename includes full or relative
path.
This one parses the named file, and it's gonna hand you back 1 if it worked, or 0 if the file could not be opened. No cap, that's the whole return contract. π
π output
$handler->output(); # any arguments are ignored.
And this one outputs the output file β according to the rules living in that %Config hash you passed in when you initialised the object, plus the template. Also, heads up bestie: any arguments are ignored π so don't bother passing any, she's not listening.
π little reminder:Parsereturns0when it can't open the file, so if you're out here not checking that return value, that's on you, and it's giving undefined behaviour of the soul.
perl v5.36.0 Β· 2022-11-02 Β· Autodi...er::PHP(3pm)
and that's the whole page, bestie β go parse some .php files, ily, bye πππ¦
π¦ where this page comes from
- debian bookworm: autodia 2.14-5 Β· GPL-2.0-only
- debian trixie: autodia 2.14-5 Β· GPL-2.0-only
- ubuntu noble: autodia 2.14-5 Β· GPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms