I have a huge system that I’m converting from a cgi to a daemon, and I need to find all the variables that end up being global (as in not declared with my $…).
They are probably intended to be scoped locally, but in Perl if you accidentally forget, it doesn’t care, but now I do.
I gotta figure the perl interpreter can tell the difference, so is there a way to get it to tell me? I could go through all the code by hand, looking for declarations, but there are thousands and thousands and thousands of lines of code in this system.
perldoc strict will show all variables not declared with
my:The same thing with a list of files:
See also strictv — how unstrict is your code?; this will give you a short summary of the variables.
Here is another way using perldoc B::Xref