1PPIx::Regexp::Util(3) User Contributed Perl DocumentationPPIx::Regexp::Util(3)
2
3
4
6 PPIx::Regexp::Util - Utility functions for PPIx::Regexp;
7
9 use PPIx::Regexp::Util qw{ __instance };
10 .
11 .
12 .
13 __instance( $foo, 'Bar' )
14 or die '$foo is not a Bar';
15
17 This module contains utility functions for PPIx::Regexp which it is
18 convenient to centralize.
19
20 Double-underscore subroutines are private to the "PPIx-Regexp" package.
21 Their documentation is provided for the author's convenience only, and
22 they are subject to change without notice. Caveat user.
23
24 This module exports nothing by default.
25
27 This module can export the following subroutines:
28
29 is_ppi_regexp_element
30 is_ppi_regexp_element( $elem )
31 and print "$elem is a regexp of some sort\n";
32
33 This subroutine is public and supported.
34
35 This subroutine takes as its argument a PPI::Element. It returns a true
36 value if the argument represents a regular expression of some sort, and
37 a false value otherwise.
38
39 __instance
40 __instance( $foo, 'Bar' )
41 and print '$foo isa Bar', "\n";
42
43 This subroutine is private to the "PPIx-Regexp" package.
44
45 This subroutine returns true if its first argument is an instance of
46 the class specified by its second argument. Unlike "UNIVERSAL::isa",
47 the result is always false unless the first argument is a reference.
48
49 __is_ppi_regexp_element
50 __is_ppi_regexp_element( $elem )
51 and print "$elem is a regexp of some sort\n";
52
53 This subroutine is private to the "PPIx-Regexp" package.
54
55 This is a synonym for is_ppi_regexp_element(), and is deprecated in
56 favor of it. If called, it will complain via "Carp::cluck()" and then
57 "goto &is_ppi_regexp_element".
58
59 __ns_can
60 This subroutine is private to the "PPIx-Regexp" package.
61
62 This method is analogous to "can()", but returns a reference to the
63 code only if it is actually implemented by the invoking name space.
64
65 __post_rebless_error
66 This method is private to the "PPIx-Regexp" package. The intended use
67 is to alias it to "__PPIX_ELEM__post_reblessing()".
68
69 It takes arguments as name/value pairs. Argument "{error}" is the error
70 message; if it is omitted you get a warning with stack trace. Argument
71 "{explanation}" defaults to "{error}".
72
73 It returns the number of errors to add to the parse.
74
75 __to_ordinal_en
76 This subroutine is private to the "PPIx-Regexp" package.
77
78 This subroutine takes as its argument an integer and returns a string
79 representing its ordinal in English. For example
80
81 say __to_ordinal_en( 17 );
82 # 17th
83
85 Params::Util, which I recommend, but in the case of "PPIx::Regexp" I
86 did not want to introduce a dependency on an XS module when all I
87 really wanted was the function of that module's "_INSTANCE()"
88 subroutine.
89
91 Support is by the author. Please file bug reports at
92 <https://rt.cpan.org/Public/Dist/Display.html?Name=PPIx-Regexp>,
93 <https://github.com/trwyant/perl-PPIx-Regexp/issues>, or in electronic
94 mail to the author.
95
97 Thomas R. Wyant, III wyant at cpan dot org
98
100 Copyright (C) 2010-2022 by Thomas R. Wyant, III
101
102 This program is free software; you can redistribute it and/or modify it
103 under the same terms as Perl 5.10.0. For more details, see the full
104 text of the licenses in the directory LICENSES.
105
106 This program is distributed in the hope that it will be useful, but
107 without any warranty; without even the implied warranty of
108 merchantability or fitness for a particular purpose.
109
110
111
112perl v5.36.0 2022-07-22 PPIx::Regexp::Util(3)