Modified source files and compiled any and armel versions of packages
[pkg-perl] / deb-src / libperl-critic-perl / libperl-critic-perl-1.088 / lib / Perl / Critic / Utils / PPI.pm
1 ##############################################################################
2 #      $URL: http://perlcritic.tigris.org/svn/perlcritic/trunk/Perl-Critic/lib/Perl/Critic/Utils/PPI.pm $
3 #     $Date: 2008-07-03 10:19:10 -0500 (Thu, 03 Jul 2008) $
4 #   $Author: clonezone $
5 # $Revision: 2489 $
6 ##############################################################################
7
8 package Perl::Critic::Utils::PPI;
9
10 use 5.006001;
11 use strict;
12 use warnings;
13
14 use base 'Exporter';
15
16 our $VERSION = '1.088';
17
18 #-----------------------------------------------------------------------------
19
20 our @EXPORT_OK = qw(
21     is_ppi_expression_or_generic_statement
22     is_ppi_generic_statement
23     is_ppi_statement_subclass
24 );
25
26 our %EXPORT_TAGS = (
27     all => \@EXPORT_OK,
28 );
29
30 #-----------------------------------------------------------------------------
31
32 sub is_ppi_expression_or_generic_statement {
33     my $element = shift;
34
35     my $element_class = ref $element;
36
37     return 0 if not $element_class;
38     return 0 if not $element->isa('PPI::Statement');
39
40     return 1 if $element->isa('PPI::Statement::Expression');
41
42     return $element_class eq 'PPI::Statement';
43 }
44
45 #-----------------------------------------------------------------------------
46
47 sub is_ppi_generic_statement {
48     my $element = shift;
49
50     my $element_class = ref $element;
51
52     return 0 if not $element_class;
53     return 0 if not $element->isa('PPI::Statement');
54
55     return $element_class eq 'PPI::Statement';
56 }
57
58 #-----------------------------------------------------------------------------
59
60 sub is_ppi_statement_subclass {
61     my $element = shift;
62
63     my $element_class = ref $element;
64
65     return 0 if not $element_class;
66     return 0 if not $element->isa('PPI::Statement');
67
68     return $element_class ne 'PPI::Statement';
69 }
70
71 1;
72
73 __END__
74
75 #-----------------------------------------------------------------------------
76
77 =pod
78
79 =for stopwords
80
81 =head1 NAME
82
83 Perl::Critic::Utils::PPI - Utility functions for dealing with PPI objects.
84
85
86 =head1 DESCRIPTION
87
88 Provides classification of L<PPI::Elements>.
89
90
91 =head1 IMPORTABLE SUBS
92
93 =over
94
95 =item C<is_ppi_expression_or_generic_statement( $element )>
96
97 Answers whether the parameter is an expression or an undifferentiated
98 statement.  I.e. the parameter either is a
99 L<PPI::Statement::Expression> or the class of the parameter is
100 L<PPI::Statement> and not one of its subclasses other than
101 C<Expression>.
102
103
104 =item C<is_ppi_generic_statement( $element )>
105
106 Answers whether the parameter is an undifferentiated statement, i.e.
107 the parameter is a L<PPI::Statement> but not one of its subclasses.
108
109
110 =item C<is_ppi_statement_subclass( $element )>
111
112 Answers whether the parameter is a specialized statement, i.e. the
113 parameter is a L<PPI::Statement> but the class of the parameter is not
114 L<PPI::Statement>.
115
116
117 =back
118
119
120 =head1 AUTHOR
121
122 Elliot Shank <perl@galumph.com>
123
124 =head1 COPYRIGHT
125
126 Copyright (c) 2007-2008 Elliot Shank.  All rights reserved.
127
128 This program is free software; you can redistribute it and/or modify
129 it under the same terms as Perl itself.  The full text of this license
130 can be found in the LICENSE file included with this module.
131
132 =cut
133
134 # Local Variables:
135 #   mode: cperl
136 #   cperl-indent-level: 4
137 #   fill-column: 78
138 #   indent-tabs-mode: nil
139 #   c-indentation-style: bsd
140 # End:
141 # ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround :