Subject: | Add support for 'use constant' statements. |
The attached patch adds support for 'use constant ABC => 1'-type statements.
- Dmitri.
Subject: | perl-tags-use-constant.patch.txt |
--- Tags.pm.orig 2006-07-21 11:55:09.000000000 -0400
+++ Tags.pm 2006-07-21 13:59:16.000000000 -0400
@@ -382,6 +398,7 @@
$self->can('variable'),
$self->can('package_line'),
$self->can('sub_line'),
+ $self->can('use_constant'),
$self->can('use_line'),
);
}
@@ -491,6 +508,28 @@
return;
}
+=item C<use_constant>
+
+Parse a use costant directive.
+
+=cut
+
+sub use_constant {
+ my ($self, $line, $statement, $file) = @_;
+ if ($statement=~/^\s*use\s+constant\s+([^=[:space:]]+)/) {
+ return (
+ Perl::Tags::Tag::Constant->new(
+ name => $1,
+ file => $file,
+ line => $line,
+ linenum => $.,
+ )
+ );
+ }
+
+ return;
+}
+
=item C<use_line>
Parse a use, require, and also a use_ok line (from Test::More).
@@ -704,6 +743,17 @@
return 1;
}
+=head1 C<Perl::Tags::Tag::Constant>
+
+=head2 C<type>: c
+
+=cut
+
+package Perl::Tags::Tag::Constant;
+our @ISA = qw/Perl::Tags::Tag/;
+
+sub type { 'c' }
+
=head1 C<Perl::Tags::Tag::Recurse>
=head2 C<type>: dummy