1Perl::Critic::StricterSUusbesr::CUotnitlrsi(b3u)ted PerlPeDrolc:u:mCernittaitci:o:nStricterSubs::Utils(3)
2
3
4
6 Perl::Critic::StricterSubs::Utils
7
9 This module is part of Perl::Critic::StricterSubs.
10
12 This module holds utility methods that are shared by other modules in
13 the Perl::Critic::StricterSubs distro. Until this distro becomes more
14 mature, I would discourage you from using these subs outside of this
15 distro.
16
18 parse_quote_words( $qw_elem )
19 Gets the words from a PPI::Token::Quotelike::Words.
20
21 parse_simple_list( $list_node )
22 Returns the string literals from a PPI::Structure::List.
23
24 parse_literal_list( @nodes )
25 Returns the string literals contained anywhere in a collection of
26 PPI::Nodes.
27
28 find_declared_subroutine_names( $doc )
29 Returns a list of the names for all the subroutines that are
30 declared in the document. The package will be stripped from the
31 name. TODO: Give examples of what this will return for a given
32 $doc.
33
34 find_declared_constant_names( $doc )
35 Returns a list of the names for all the constants that were
36 declared in the document using the "constant" pragma. At the
37 moment, only these styles of declaration is supported:
38
39 use constant 'FOO' => 42; #with quotes, no parens
40 use constant BAR => 27; #no quotes, no parens
41 use constant (BAZ => 98); #no quotes, with parens
42
43 Multiple declarations per pragma are not supported at all:
44
45 use constant {WANGO => 1, TANGO => 2}; #no love here.
46
47 find_imported_subroutine_names( $doc )
48 Returns a list of the names of all subroutines that are imported
49 into the document via "use MODULE LIST;". The leading ampersand
50 sigil will be stripped. TODO: Give examples of what this will
51 return for a given $doc.
52
53 find_subroutine_calls( $doc )
54 Returns a list "PPI::Element"s, where each is the bareword name of
55 a static subroutine invocation. If the subroutine call is fully-
56 qualified the package will still be attached to the name. In all
57 cases, the leading sigil will be removed. TODO: Give examples of
58 what this will return for a given $doc.
59
60 find_exported_subroutine_names( $doc )
61 Returns a list of the names of each subroutine that is marked for
62 exportation via @EXPORT or @EXPORT_OK. Be aware that %EXPORT_TAGS
63 are not supported here. TODO: Give examples of what this will
64 return for a given $doc.
65
66 get_package_names_from_include_statements( $doc )
67 Returns a list of module names referred to with a bareword in an
68 include statement. This covers all include statements, such as:
69
70 use Foo;
71 require Foo;
72
73 sub load_foo {
74 require Foo if $condition;
75 }
76
77 eval{ require Foo };
78
79 INIT {
80 require Foo;
81 }
82
83 But it does not cover these:
84
85 require "Foo.pm";
86 eval { require $foo };
87
88 get_package_names_from_package_statements( $doc )
89 Returns a list of all the namespaces from all the packages
90 statements that appear in the document.
91
92 "find_exported_sub_names( $doc, @export_types )"
93 Returns a list of subroutines which are exported via the specified
94 export types. If @export_types is empty, it defaults to "qw{
95 @EXPORT, @EXPORT_OK }".
96
97 Subroutine names are returned as in
98 get_all_subs_from_list_of_symbols().
99
100 get_all_subs_from_list_of_symbols( @symbols )
101 Returns a list of all the input symbols which could be subroutine
102 names.
103
104 Subroutine names are considered to be those symbols that don't have
105 scalar, array, hash, or glob sigils. Any subroutine sigils are
106 stripped off; i.e. &foo will be returned as "foo".
107
109 Exporter
110
112 Jeffrey Ryan Thalhammer <thaljef@cpan.org>
113
115 Copyright (c) 2007 Jeffrey Ryan Thalhammer. All rights reserved.
116
117 This program is free software; you can redistribute it and/or modify it
118 under the same terms as Perl itself. The full text of this license can
119 be found in the LICENSE file included with this module.
120
121
122
123perl v5.36.0 2023-01-2P0erl::Critic::StricterSubs::Utils(3)