Skip to content

Instantly share code, notes, and snippets.

@leedo
Created January 5, 2013 00:56
Show Gist options
  • Save leedo/4458922 to your computer and use it in GitHub Desktop.
Save leedo/4458922 to your computer and use it in GitHub Desktop.
open my $wp_config, '<', '../wp-config.php';
my $define_re = qr{define\( \s* ["'] ([^"']+) ["'] \s* , \s* ["'] ([^"']+) ["'] \s* \)}x;
my %config;
while (my $line = <$wp_config>) {
if (my ($constant, $value) = $line =~ $define_re) {
$config{$constant} = $value;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment