File: Sub.pm

package info (click to toggle)
plsense 0.3.4-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,012 kB
  • sloc: perl: 9,767; makefile: 2
file content (30 lines) | stat: -rw-r--r-- 685 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package PlSense::Plugin::CodeAssistant::Sub;

use parent qw{ PlSense::Plugin::CodeAssistant };
use strict;
use warnings;
use Class::Std;
use PlSense::Logger;
use PlSense::Util;
{
    sub is_only_valid_context {
        my ($self, $code, $tok) = @_;

        if ( $code !~ m{ ^ \s* sub \s+ ([a-zA-Z0-9_]*) \z }xms ) { return; }
        my $input = $1;

        $self->set_input($input);
        logger->info("Match context : input[$input]");

        my $currmdl = addrfinder->get_currentmodule;
        INHERIT_METHOD:
        foreach my $mtd ( $currmdl->get_inherit_methods ) {
            $self->push_candidate($mtd->get_name, $mtd);
        }
        return 1;
    }
}

1;

__END__