Document(3pm)
π NAME π
App::perlimports::Document β bestie, we're making implicit imports explicit β¨ like, out loud, on the page, no more hiding π«Ά
π VERSION π
version 0.000060 β yes it's slaying, keep up π
π§ MOTIVATION π§
okay so listen π this module is strictly for internal use by perlimports. It's the backstage crew, the stagehands, the little guys behind the curtain. Nothing else should be relying on it, fr fr β so don't you dare build your whole app on top of it, that's not the vibe π.
π inspector_for( $module_name )
Hands you back an App::perlimports::ExporterInspector object for whatever module name you pass in. That's it, that's the whole thing π
β
linter_success
Returns true if the document got linted with zero errors, otherwise false. A little vibe check for your file π β true means we're thriving, false means we're not π₯²
πͺ tidied_document
Returns a serialized PPI document with (hopefully π) tidy import statements. Emphasis on hopefully, bestie β we do our best.
πΈ ATTRIBUTES πΈ
π constants
A hashref catalog of every detected constant in the document. So like, the line:
use constant FIRST_IDX => 0;
gives you a matching entry in the constants hashref:
FIRST_IDX => {
name => 'FIRST_IDX', # (plain string)
token => 'FIRST_IDX', # (PPI::Token::Word usually)
definition => [ PPI::Token.. ],
end => { line => 9, column => 32 },
},
The end is the (line, character) position of the last character of the constant import statement. Why do you care? Because the constant is only actually defined at compile time, and only after this statement β so the position is genuinely useful info fr π§
β οΈ heads up bestie: locations can become stale! Don't trust them forever, okay? π
The name field is the hero when the constant got defined with atypical syntax (no fat arrow), because the token doesn't stringify the same way. Watch:
use constant 'FIRST_IDX', 0;
# token eq "'FIRST_IDX'", # (PPI::Token::Quote::Single)
# name eq 'FIRST_IDX', # same as $token->string
See?? The token is out here with quotes and the name is just clean π«§ iconic behaviour honestly.
π¦ includes
An arrayref of PPI::Statement::Include statements found in the document β but excluding pragmas, ignored modules, and 'use VERSION' statements. They're not invited to this party π
βοΈ
ποΈ found_imports
A hashref catalog of symbols imported from each package by a use statement, like:
{ Carp => ['croak', ..], ... }
Now here's the tea β, and it depends on your mode:
- In lint mode, this attribute is never altered. Hands off, it's chillin' π΄
- In edit mode, when
tidied_documentgets called, every include that gets processed updates this list to what we think it should be β¨
Why do we bother? So we can keep track of what the previous modules are really importing, which lets us avoid duplicate imports β you know, the same symbol name coming in from different packages π΅βπ« Nobody wants that mess.
π AUTHOR π
Olaf Alders <olaf@wundercounter.com> β king behaviour, we stan π«Ά
π COPYRIGHT AND LICENSE π
This software is copyright (c) 2020 by Olaf Alders.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. So like, go forth and remix bestie π
aaaand that's the whole page!! brought to you by perl v5.40.1, dated 2026-05-11, filed under Document(3pm) β mwah, go read some source code, ily ππβ¨
π¦ where this page comes from
- ubuntu stonking: perlimports 0.000060-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