++ed by:

1 PAUSE user
1 non-PAUSE user.

Author image osfameron


A naive implementation. That is to say, it's based on the classic pltags.pl script distributed with Perl, which is by and large a better bet than the results produced by ctags. But a "better" approach may be to integrate this with PPI.


See TodoTagger in the t/ directory of the distribution for a fully working example (tested in <t/02_subclass.t>). You may want to reuse parsers in the ::Naive package, or use all of the existing parsers and add your own.

    package My::Tagger;
    use Perl::Tags;
    use parent 'Perl::Tags::Naive';

    sub get_parsers {
        my $self = shift;
        return (
            $self->can('todo_line'),     # a new parser
            $self->SUPER::get_parsers(), # all ::Naive's parsers
            # or maybe...
            $self->can('variable'),      # one of ::Naive's parsers

    sub todo_line { 
        # your new parser code here!
    sub package_line {
        # override one of ::Naive's parsers

Because ::Naive uses can('parser') instead of \&parser, you can just override a particular parser by redefining in the subclass.


::Naive uses a simple line-by-line analysis of Perl code, comparing each line against an array of parsers returned by the get_parsers method.

The first of these parsers that matches (if any) will return the tag/control to be registred by the tagger.


The following parsers are defined by this module.


A filter rather than a parser, removes whitespace and comments.


Tags definitions of my, our, and local variables.

Returns a Perl::Tags::Tag::Var if found


Parse a package declaration, returning a Perl::Tags::Tag::Package if found.


Parse the declaration of a subroutine, returning a Perl::Tags::Tag::Sub if found.


Parse a use constant directive


Parse a use, require, and also a use_ok line (from Test::More). Uses a dummy tag (Perl::Tags::Tag::Recurse to do so).


Parse label declaration