| Devel-FIXME documentation | Contained in the Devel-FIXME distribution. |
Devel::FIXME::Rules::PerlFile - Support for rules stored as perl code in a file.
% vim ~/.fixme/rules.pl
The file in the SYNOPSIS, or the file specified by the FIXME_RULEFILE
environment variable, needs to return an array reference, containing code
references.
These code references are the rules that are applied as methods on the fixme object.
This is a really silly rules file, but it does show what you can do:
[
sub {
my $self = shift;
# discard any file that is writable (assume not checked in to SCM)
return DROP unless -w $self->{file};
},
sub {
my $self = shift;
# any FIXME's in my dir are warned about
return SHOUT if $self->{file} =~ m!my/src/dir/!;
},
];
The fixme object contains some fields. See Devel::FIXME's implementation.
Yuval Kogman <nothingmuch@woobling.org>
Copyright (c) 2004 Yuval Kogman. All rights reserved This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
| Devel-FIXME documentation | Contained in the Devel-FIXME distribution. |
#!/usr/bin/perl package Devel::FIXME::Rules::PerlFile; use base qw/Devel::FIXME/; use Devel::FIXME qw/:constants/; my @rules; my $rulesfile; BEGIN { my $base = $ENV{FIXME_RULEFILE} || "/.fixme/rules.pl"; $rulesfile = $ENV{HOME} . $base; } sub rules { my $self = shift; if (!@rules){ if (!$ENV{FIXME_NOFILTER} and -f $rulesfile){ @rules = @{ require $rulesfile }; } else { @rules = ( sub { return SHOUT } ); } } return @rules; } __PACKAGE__ __END__