PPIx::...tement(3pm)

πŸ“¦
version 1.001000 Β· 6 versions
, in debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

✨ NAME ✨

PPIx::Utilities::Statement β€” it's giving Extensions to PPI::Statement πŸ’– (this is the PPIx::...tement page from the perl manual, bestie, we're doing it)


🌸 VERSION 🌸

This document describes PPIx::Utilities::Statement version 1.1.0. iconic, we stan a versioned doc πŸ’…


πŸ¦‹ SYNOPSIS πŸ¦‹

okay so like, here's the whole vibe in code form:

use PPI::Document qw< >;

use PPIx::Utilities::Statement qw<
    get_constant_name_elements_from_declaring_statement
>;

my $document = PPI::Document->new(\'Readonly::Scalar my $THINGY => 47.2;');

# Returns the PPI::Token::Symbol for "$THINGY".
my ($constant) = get_constant_name_elements_from_declaring_statement(
    $document->schild(0)
);

yes bestie, that comment says it returns the PPI::Token::Symbol for "$THINGY" β€” no cap, it's right there in the source 🫢


πŸŽ€ DESCRIPTION πŸŽ€

So basically this module is a collection of functions for dealing with PPI::Statement objects. that's it, that's the whole assignment. PPI::Statements and the girls who love them πŸ’œ


✨ INTERFACE ✨

⚠️ heads up: Nothing is exported by default. you have to ask nicely (aka import it yourself, iykyk).

πŸ“ "get_constant_name_elements_from_declaring_statement($statement)"

okay so picture this: you hand it a PPI::Statement. if that statement is a Readonly or Const::Fast declaration statement, or a "use constant", then boom β€” it hands you back the names of the things being defined. ✨

Given this:

use constant 1.16 FOO => 'bar';

this will return the PPI::Token::Word containing 'FOO'. πŸ’–

Given this:

use constant 1.16 { FOO => 'bar', 'BAZ' => 'burfle' };

this will return a list of the PPI::Tokens containing 'FOO' and 'BAZ'. two of them. a little squad. 🫢

Similarly, given:

Readonly::Hash my %FOO => ( bar => 'baz' );

or:

const my %FOO => ( bar => 'baz' );

this will return the PPI::Token::Symbol containing '%FOO'. slay.


πŸ’€ BUGS AND LIMITATIONS πŸ’€

not me having bugs 😭 please report any bugs or feature requests to "bug-ppix-utilities@rt.cpan.org", or through the web interface at <http://rt.cpan.org>. (no tables, no links, just vibes and a URL, bestie β€” that's the manpage way.)


πŸ‘‘ AUTHOR πŸ‘‘

Thomas R. Wyant, III "<wyant at cpan dot org>" β€” the main character who wrote this fr fr 🌈


Copyright (c) 2009-2010 Thomas R. Wyant, III. All rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. The full text of this license can be found in the LICENSE file included with this module. periodt. 🧚


and that's the whole page bestie, brought to you by perl v5.36.0, dated 2022-11-27, from the PPIx::...tement(3pm) manual β€” go forth and parse some statements, you absolute icon πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from