Scrape PHP Globals 0.1
I needed to extract all the explicitly declared global variables in a PHP script so I wrote a Perl script to do it for me. It then occured to me that maybe other people might find it useful, so I tidied it up a bit and released it on my site as Scrape PHP Globals.
It extracts all variable names occurring between “global” and a semicolon, then prints them out nicely as a new global statement.
August 22nd, 2006 at 11:51 pm
FWIW:
$numArgs = $#ARGV + 1;
die($usage) if($numArgs 1) ? $ARGV[1] : 79;
can be rewritten as:
my $filename = shift; # get first argument
( $filename eq ‘–help’ or $filename eq ‘-h’ ) and die $usage;
my $cols = shift; # get second argument
defined $cols or $cols = 79;
HTH,
John Bokma
August 22nd, 2006 at 11:53 pm
Somehow WordPress ate up the Perl code I posted :-(