summaryrefslogtreecommitdiff
path: root/regress/style/listup_command_lock.pl
blob: bb923455cc21b858743e96594f05aed55d80bdec (plain)
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/usr/bin/env perl
#
# $FML: list_up_command_lock.pl,v 1.1 2003/05/31 04:42:31 fukachan Exp $
#

for my $x (<AdminCommand/*pm UserCommand/*pm>) {
    _check($x);
}

exit 0;


sub _check
{
    my ($file) = @_;
    my $need_lock = 0;
    my $channel   = '';
    my $isa = '';

    use FileHandle;
    my $fh = new FileHandle $file;
    if (defined $fh) {
	while (<$fh>) { 
	    chomp;

	    if (/\@ISA\s*=\s*qw\(([A-Za-z:]+)/) {
		$isa = $1;
		$isa =~ s/FML::Command:://;
	    }

	    if (/sub need_lock.*1/) {
		$need_lock = 1;
	    }

	    if (/sub lock_channel.*return\s*[\'\"](\S+)[\'\"]/) {
		$channel = $1;
	    }

	}

	$fh->close();
    }

    if ($isa) {
	printf "%-30s  %3s   %s\n", $file, "==>", $isa;
    }
    else {
	printf 
	    "%-30s  %3s   %s\n", 
	    $file, 
	    ($need_lock ? "yes" : "no"), 
	    $channel;
    }
}