Subject: | The 'chunk' concept for things like 'use base' is totally wrong |
Went to try to add Class::Autouse support for Module::Scandeps and discovered it uses a "chunk" concept, where a chunk is split /;/ within a single line.
Which is useless to me, since I have tons of
use Class::Autouse 'CGI',
'Class::Inspector',
'File::Find::Rule',
etc,
etc;
SO!
Scanning for things like use base and use Class::Autouse etc need to be broken out into a seperate scan area.
The best method to use would be something like the following untested code.
$_ = $all_file_content;
while ( m/(?<=\n)\s*use\s+base\b\s*(.+?)\;/m ) {
free_from_evil( $1 ) or die "WTF is this... '$1'";
eval "@classes = ($1)";
add_classes( @classes );
}
you get the idea.
I'd probably wrap the whole '(newline)(pattern)(arguments across multiple lines)' concept up into a single function of something.
Anyways, if you can add the basic infrastructure ( and maybe drop some comments in while you are there ) I can do some per-rule patches afterwards.