nicku has asked for the wisdom of the Perl Monks concerning the following question:
I have a problem where many people edit a complex Perl hash that is more than two megabytes in size. [I know, it's crazy.] Some human editors know Perl more than others. How to quickly identify that some component has an odd number of hash elements?
I can do that on the main file with:
my $error = qx(perl -we "require qq{$file}" 2>&1);
warn "$error\n" and return if $error;
But this main file also requires many sub files, which use global variables defined in the main file. This trick does not work with these sub files since there are many undefined global variables in these otherwise (normally) syntactically correct files.
Naturally, I am also doing something along the lines of my $ok = 0 == system '/usr/bin/perl', '-Mstrict', '-c', $file; but that does not catch hashref components with odd numbers of elements.
Can anyone suggest a way of checking for odd number of elements in hashrefs and other such syntactical no nos?
On a related note, can anyone suggest a way of determining the location of the offending problem(s)?
|
|---|